Module: SpaceInvaders::Fireable
- Included in:
- InvadersContainer, Ship
- Defined in:
- lib/space_invaders/behaviors/fireable.rb
Instance Method Summary collapse
- #bullet_collection ⇒ Object (also: #bullets)
- #bullet_offset_speed ⇒ Object
- #bullets_going_down? ⇒ Boolean
- #fire! ⇒ Object
- #shooter ⇒ Object
- #sound ⇒ Object
Instance Method Details
#bullet_collection ⇒ Object Also known as: bullets
7 8 9 |
# File 'lib/space_invaders/behaviors/fireable.rb', line 7 def bullet_collection @bullet_collection ||= BulletCollection.new end |
#bullet_offset_speed ⇒ Object
30 31 32 |
# File 'lib/space_invaders/behaviors/fireable.rb', line 30 def bullet_offset_speed 5 end |
#bullets_going_down? ⇒ Boolean
26 27 28 |
# File 'lib/space_invaders/behaviors/fireable.rb', line 26 def bullets_going_down? true end |
#fire! ⇒ Object
13 14 15 16 |
# File 'lib/space_invaders/behaviors/fireable.rb', line 13 def fire! bullet = Bullet.new(shooter, bullets_going_down?, bullet_collection, bullet_offset_speed) sound.play end |
#shooter ⇒ Object
18 19 20 |
# File 'lib/space_invaders/behaviors/fireable.rb', line 18 def shooter raise NotImplementedError.new("You must implement the inherited shooter method") end |
#sound ⇒ Object
22 23 24 |
# File 'lib/space_invaders/behaviors/fireable.rb', line 22 def sound raise NotImplementedError.new("You must implement the inherited sound method") end |