class Powerup

Public Class Methods

new(object_pool, x, y) click to toggle source
Calls superclass method GameObject::new
# File lib/entities/powerups/powerup.rb, line 2
def initialize(object_pool, x, y)
  super
  PowerupGraphics.new(self, graphics)
end

Public Instance Methods

box() click to toggle source
# File lib/entities/powerups/powerup.rb, line 7
def box
  [x - 8, y - 8,
   x + 8, y - 8,
   x + 8, y + 8,
   x - 8, y + 8]
end
on_collision(object) click to toggle source
# File lib/entities/powerups/powerup.rb, line 14
def on_collision(object)
  if pickup(object)
    PowerupSounds.play(object, object_pool.camera)
    remove
  end
end
pickup(object) click to toggle source
# File lib/entities/powerups/powerup.rb, line 21
def pickup(object)
  # override and implement application
end
remove() click to toggle source
# File lib/entities/powerups/powerup.rb, line 25
def remove
  object_pool.powerup_respawn_queue.enqueue(
    respawn_delay,
    self.class, x, y)
  mark_for_removal
end
respawn_delay() click to toggle source
# File lib/entities/powerups/powerup.rb, line 32
def respawn_delay
  30
end