Class: Chronus::GameObject
- Defined in:
- lib/chronus/game_object.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#visible ⇒ Object
Returns the value of attribute visible.
-
#width ⇒ Object
Returns the value of attribute width.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
-
#z ⇒ Object
Returns the value of attribute z.
Instance Method Summary collapse
-
#bottom ⇒ Object
Returns the bottom position.
- #hide ⇒ Object
-
#initialize ⇒ GameObject
constructor
A new instance of GameObject.
-
#left ⇒ Object
Returns the left position.
-
#pos(x, y) ⇒ Object
Sets X and Y position.
-
#right ⇒ Object
Returns the right position.
- #show ⇒ Object
-
#top ⇒ Object
Returns the top position.
Constructor Details
#initialize ⇒ GameObject
7 8 9 10 11 12 13 14 15 |
# File 'lib/chronus/game_object.rb', line 7 def initialize @x = 0 @y = 0 @width = 0 @height = 0 @z = 0 @visible = true @last_update = 0 end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
6 7 8 |
# File 'lib/chronus/game_object.rb', line 6 def height @height end |
#visible ⇒ Object
Returns the value of attribute visible.
6 7 8 |
# File 'lib/chronus/game_object.rb', line 6 def visible @visible end |
#width ⇒ Object
Returns the value of attribute width.
6 7 8 |
# File 'lib/chronus/game_object.rb', line 6 def width @width end |
#x ⇒ Object
Returns the value of attribute x.
6 7 8 |
# File 'lib/chronus/game_object.rb', line 6 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
6 7 8 |
# File 'lib/chronus/game_object.rb', line 6 def y @y end |
#z ⇒ Object
Returns the value of attribute z.
6 7 8 |
# File 'lib/chronus/game_object.rb', line 6 def z @z end |
Instance Method Details
#bottom ⇒ Object
Returns the bottom position
36 37 38 |
# File 'lib/chronus/game_object.rb', line 36 def bottom @y + @height end |
#hide ⇒ Object
21 22 23 |
# File 'lib/chronus/game_object.rb', line 21 def hide @visible = false end |
#left ⇒ Object
Returns the left position
41 42 43 |
# File 'lib/chronus/game_object.rb', line 41 def left @x end |
#pos(x, y) ⇒ Object
Sets X and Y position
46 47 48 49 |
# File 'lib/chronus/game_object.rb', line 46 def pos(x, y) @x = x @y = y end |
#right ⇒ Object
Returns the right position
31 32 33 |
# File 'lib/chronus/game_object.rb', line 31 def right @x + @width end |
#show ⇒ Object
17 18 19 |
# File 'lib/chronus/game_object.rb', line 17 def show @visible = true end |
#top ⇒ Object
Returns the top position
26 27 28 |
# File 'lib/chronus/game_object.rb', line 26 def top @y end |