Class: Enemy
- Inherits:
-
Chingu::GameObject
- Object
- Chingu::GameObject
- Enemy
- Defined in:
- lib/prkwars/enemy.rb
Overview
A generic Enemy class inheriting from Chingu::Gameobject. Any enemy unit inherits from this class. The class contains a method which returns all the descendants - useful for checking all possible collisions.
Instance Attribute Summary collapse
-
#hp ⇒ Object
Returns the value of attribute hp.
Class Method Summary collapse
Instance Attribute Details
#hp ⇒ Object
Returns the value of attribute hp.
8 9 10 |
# File 'lib/prkwars/enemy.rb', line 8 def hp @hp end |
Class Method Details
.descendants ⇒ Object
13 14 15 |
# File 'lib/prkwars/enemy.rb', line 13 def self.descendants ObjectSpace.each_object(::Class).select { |klass| klass < self } end |