Class: Game_Switches

Inherits:
Object
  • Object
show all
Defined in:
Game_Switches.rb

Overview

** Game_Switches


This class handles switches. It's a wrapper for the built-in class "Array."

The instance of this class is referenced by $game_switches.

Instance Method Summary (collapse)

Constructor Details

- (Game_Switches) initialize


  • Object Initialization




12
13
14
# File 'Game_Switches.rb', line 12

def initialize
  @data = []
end

Instance Method Details

- (Object) [](switch_id)


  • Get Switch




18
19
20
# File 'Game_Switches.rb', line 18

def [](switch_id)
  @data[switch_id] || false
end

- (Object) []=(switch_id, value)


  • Set Switch

    value : ON (true) / OFF (false)



25
26
27
28
# File 'Game_Switches.rb', line 25

def []=(switch_id, value)
  @data[switch_id] = value
  on_change
end

- (Object) on_change


  • Processing When Setting Switches




32
33
34
# File 'Game_Switches.rb', line 32

def on_change
  $game_map.need_refresh = true
end