Class: Ruby2d::Tiled::World
- Inherits:
-
Object
- Object
- Ruby2d::Tiled::World
- Defined in:
- lib/ruby2d/tiled/world.rb
Instance Attribute Summary collapse
-
#levels ⇒ Object
readonly
Returns the value of attribute levels.
-
#scale ⇒ Object
Returns the value of attribute scale.
-
#x_offset ⇒ Object
Returns the value of attribute x_offset.
-
#y_offset ⇒ Object
Returns the value of attribute y_offset.
Instance Method Summary collapse
- #clear ⇒ Object
-
#initialize(data, levels) ⇒ World
constructor
A new instance of World.
- #next_level ⇒ Object
- #prev_level ⇒ Object
- #show ⇒ Object
Constructor Details
#initialize(data, levels) ⇒ World
Returns a new instance of World.
8 9 10 11 12 13 14 15 16 |
# File 'lib/ruby2d/tiled/world.rb', line 8 def initialize(data, levels) @data = data @levels = levels @current_level = 0 @scale = 1 @x_offset = 0 @y_offset = 0 @angle = 0 end |
Instance Attribute Details
#levels ⇒ Object (readonly)
Returns the value of attribute levels.
6 7 8 |
# File 'lib/ruby2d/tiled/world.rb', line 6 def levels @levels end |
#scale ⇒ Object
Returns the value of attribute scale.
6 7 8 |
# File 'lib/ruby2d/tiled/world.rb', line 6 def scale @scale end |
#x_offset ⇒ Object
Returns the value of attribute x_offset.
6 7 8 |
# File 'lib/ruby2d/tiled/world.rb', line 6 def x_offset @x_offset end |
#y_offset ⇒ Object
Returns the value of attribute y_offset.
6 7 8 |
# File 'lib/ruby2d/tiled/world.rb', line 6 def y_offset @y_offset end |
Instance Method Details
#clear ⇒ Object
26 27 28 |
# File 'lib/ruby2d/tiled/world.rb', line 26 def clear @levels[@current_level].clear end |
#next_level ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/ruby2d/tiled/world.rb', line 30 def next_level if @levels.size > @current_level + 1 clear @current_level += 1 show end end |
#prev_level ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/ruby2d/tiled/world.rb', line 38 def prev_level if @current_level > 0 clear @current_level -= 1 show end end |
#show ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/ruby2d/tiled/world.rb', line 18 def show clear @levels[@current_level].scale = @scale @levels[@current_level].x_offset = @x_offset @levels[@current_level].y_offset = @y_offset @levels[@current_level].show end |