Class: RPG::Map

Inherits:
Object
  • Object
show all
Defined in:
lib/rpg/map.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width, height) ⇒ Map

Returns a new instance of Map.



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rpg/map.rb', line 5

def initialize(width, height)
  @tileset_id = 1
  @width = width
  @height = height
  @autoplay_bgm = false
  @bgm = RPG::AudioFile.new
  @autoplay_bgs = false
  @bgs = RPG::AudioFile.new("", 80)
  @encounter_list = []
  @encounter_step = 30
  @data = Table.new(width, height, 3)
  @events = {}
end

Instance Attribute Details

#autoplay_bgmObject

Truth-value of whether BGM autoswitching is enabled.



29
30
31
# File 'lib/rpg/map.rb', line 29

def autoplay_bgm
  @autoplay_bgm
end

#autoplay_bgsObject

Truth-value of whether BGS autoswitching is enabled.



35
36
37
# File 'lib/rpg/map.rb', line 35

def autoplay_bgs
  @autoplay_bgs
end

#bgmObject

If BGM autoswitching is enabled, the name of that BGM (AudioFile).



32
33
34
# File 'lib/rpg/map.rb', line 32

def bgm
  @bgm
end

#bgsObject

If BGS autoswitching is enabled, the name of that BGS (AudioFile).



38
39
40
# File 'lib/rpg/map.rb', line 38

def bgs
  @bgs
end

#dataObject

The map data. A 3-dimensional tile ID Table.



47
48
49
# File 'lib/rpg/map.rb', line 47

def data
  @data
end

#encounter_listObject

Encounter list. A troop ID array.



41
42
43
# File 'lib/rpg/map.rb', line 41

def encounter_list
  @encounter_list
end

#encounter_stepObject

Number of steps between encounters.



44
45
46
# File 'lib/rpg/map.rb', line 44

def encounter_step
  @encounter_step
end

#eventsObject

Map events. A hash that represents Event instances as values, using event IDs as the keys.



51
52
53
# File 'lib/rpg/map.rb', line 51

def events
  @events
end

#heightObject

The map height.



26
27
28
# File 'lib/rpg/map.rb', line 26

def height
  @height
end

#tileset_idObject

Tileset ID to be used in the map.



20
21
22
# File 'lib/rpg/map.rb', line 20

def tileset_id
  @tileset_id
end

#widthObject

The map width.



23
24
25
# File 'lib/rpg/map.rb', line 23

def width
  @width
end