class Enemy
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.
Attributes
hp[RW]
Each enemy has hitpoints, how many has to be specified by the enemy class!
Public Class Methods
descendants()
click to toggle source
Method returning all the descendants of the Enemy
class. Used for collision checks in the main game loop.
# File lib/prkwars/enemy.rb, line 20 def self.descendants ObjectSpace.each_object(::Class).select { |klass| klass < self } end