class BulletTurret

A bullet shot by the Turret enemy unit. Destroys itself if out of bounds.

Public Class Methods

new(gamespace, options = {}) click to toggle source

Initializes gamespace in which the bullet is present and assigns the turret. Velocity of the bullet is passed as an options parameter, used by the chingu library.

Calls superclass method
# File lib/prkwars/bullet_turret.rb, line 16
def initialize(gamespace, options = {})
  super(options)
  @image = Image['media/bullet_turret.png']
  @gamespace = gamespace
end

Public Instance Methods

update() click to toggle source

As velocity is set by chingu, the only thing update does is that it checks whether there's any reason for the bullets to exist - if not, they get destroyed.

# File lib/prkwars/bullet_turret.rb, line 26
def update
  destroy! unless in_bounds(self, @gamespace)
end