Module: Chingu::Helpers::GameObject
Overview
Convenience-methods for classes that hold game objects Mixed into Chingu::Window and Chingu::GameState
Instance Method Summary collapse
- #add_game_object(object) ⇒ Object
- #game_objects ⇒ Object
-
#game_objects_of_class(klass) ⇒ Object
Fetch game objects of a certain type/class.
- #remove_game_object(object) ⇒ Object
Instance Method Details
#add_game_object(object) ⇒ Object
32 33 34 |
# File 'lib/chingu/helpers/game_object.rb', line 32 def add_game_object(object) @game_objects.add_game_object(object) end |
#game_objects ⇒ Object
40 41 42 |
# File 'lib/chingu/helpers/game_object.rb', line 40 def game_objects @game_objects end |
#game_objects_of_class(klass) ⇒ Object
Fetch game objects of a certain type/class
47 48 49 |
# File 'lib/chingu/helpers/game_object.rb', line 47 def game_objects_of_class(klass) @game_objects.select { |game_object| game_object.is_a? klass } end |
#remove_game_object(object) ⇒ Object
36 37 38 |
# File 'lib/chingu/helpers/game_object.rb', line 36 def remove_game_object(object) @game_objects.remove_game_object(object) end |