Class: Chobo::GameObject
- Inherits:
-
Object
- Object
- Chobo::GameObject
- Defined in:
- lib/chobo/game_object.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#color ⇒ Object
Returns the value of attribute color.
-
#origin ⇒ Object
Returns the value of attribute origin.
-
#position ⇒ Object
Returns the value of attribute position.
-
#rotation ⇒ Object
Returns the value of attribute rotation.
-
#scale ⇒ Object
Returns the value of attribute scale.
-
#velocity ⇒ Object
Returns the value of attribute velocity.
Instance Method Summary collapse
-
#initialize ⇒ GameObject
constructor
A new instance of GameObject.
- #set_color(r = 255, g = 255, b = 255, a = 255) ⇒ Object
- #set_position(x, y) ⇒ Object
- #set_rotation(rotation) ⇒ Object
- #set_scale(scale_x, scale_y = nil) ⇒ Object
- #set_velocity(x, y) ⇒ Object
- #update(dt) ⇒ Object
Constructor Details
Instance Attribute Details
#color ⇒ Object
Returns the value of attribute color.
3 4 5 |
# File 'lib/chobo/game_object.rb', line 3 def color @color end |
#origin ⇒ Object
Returns the value of attribute origin.
3 4 5 |
# File 'lib/chobo/game_object.rb', line 3 def origin @origin end |
#position ⇒ Object
Returns the value of attribute position.
3 4 5 |
# File 'lib/chobo/game_object.rb', line 3 def position @position end |
#rotation ⇒ Object
Returns the value of attribute rotation.
3 4 5 |
# File 'lib/chobo/game_object.rb', line 3 def rotation @rotation end |
#scale ⇒ Object
Returns the value of attribute scale.
3 4 5 |
# File 'lib/chobo/game_object.rb', line 3 def scale @scale end |
#velocity ⇒ Object
Returns the value of attribute velocity.
3 4 5 |
# File 'lib/chobo/game_object.rb', line 3 def velocity @velocity end |
Instance Method Details
#set_color(r = 255, g = 255, b = 255, a = 255) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/chobo/game_object.rb', line 40 def set_color r = 255, g = 255, b = 255, a = 255 @color.red = r @color.green = g @color.blue = b @color.alpha = a self end |
#set_position(x, y) ⇒ Object
14 15 16 17 |
# File 'lib/chobo/game_object.rb', line 14 def set_position x, y @position.x, @position.y = x, y self end |
#set_rotation(rotation) ⇒ Object
35 36 37 38 |
# File 'lib/chobo/game_object.rb', line 35 def set_rotation rotation @rotation = rotation self end |
#set_scale(scale_x, scale_y = nil) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/chobo/game_object.rb', line 24 def set_scale scale_x, scale_y = nil if scale_y @scale.x = scale_x @scale.y = scale_y else @scale.x = scale_x @scale.y = scale_x end self end |
#set_velocity(x, y) ⇒ Object
19 20 21 22 |
# File 'lib/chobo/game_object.rb', line 19 def set_velocity x, y @velocity.x, @velocity.y = x, y self end |
#update(dt) ⇒ Object
48 49 |
# File 'lib/chobo/game_object.rb', line 48 def update dt end |