class Bullet
Attributes
fired_at[RW]
source[RW]
speed[RW]
target_x[RW]
target_y[RW]
Public Class Methods
new(object_pool, source_x, source_y, target_x, target_y)
click to toggle source
Calls superclass method
GameObject::new
# File lib/entities/bullet.rb, line 4 def initialize(object_pool, source_x, source_y, target_x, target_y) super(object_pool, source_x, source_y) @target_x, @target_y = target_x, target_y BulletPhysics.new(self, object_pool) BulletGraphics.new(self) BulletSounds.play(self, object_pool.camera) end
Public Instance Methods
box()
click to toggle source
# File lib/entities/bullet.rb, line 12 def box [@x, @y] end
explode()
click to toggle source
# File lib/entities/bullet.rb, line 16 def explode Explosion.new(object_pool, @x, @y, @source) mark_for_removal end
fire(source, speed)
click to toggle source
# File lib/entities/bullet.rb, line 21 def fire(source, speed) @source = source @speed = speed @fired_at = Gosu.milliseconds end