Class: Game_Variables

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

Overview

** Game_Variables


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

The instance of this class is referenced by $game_variables.

Instance Method Summary (collapse)

Constructor Details

- (Game_Variables) initialize


  • Object Initialization




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

def initialize
  @data = []
end

Instance Method Details

- (Object) [](variable_id)


  • Get Variable




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

def [](variable_id)
  @data[variable_id] || 0
end

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


  • Set Variable




24
25
26
27
# File 'Game_Variables.rb', line 24

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

- (Object) on_change


  • Processing When Setting Variables




31
32
33
# File 'Game_Variables.rb', line 31

def on_change
  $game_map.need_refresh = true
end