Class: BulletTurret

Inherits:
Chingu::GameObject
  • Object
show all
Includes:
GamespacePersistence
Defined in:
lib/prkwars/bullet_turret.rb

Overview

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

Instance Method Summary collapse

Methods included from GamespacePersistence

#correct_coords, #in_bounds

Constructor Details

#initialize(gamespace, options = {}) ⇒ BulletTurret



11
12
13
14
15
# File 'lib/prkwars/bullet_turret.rb', line 11

def initialize(gamespace, options = {})
  super(options)
  @image = Image['media/bullet_turret.png']
  @gamespace = gamespace
end

Instance Method Details

#updateObject



17
18
19
# File 'lib/prkwars/bullet_turret.rb', line 17

def update
  destroy! unless in_bounds(self, @gamespace)
end