Class: SpaceInvaders::Sounds

Inherits:
Base
  • Object
show all
Defined in:
lib/space_invaders/statics/sounds.rb

Instance Attribute Summary

Attributes inherited from Base

#app

Instance Method Summary collapse

Methods inherited from Base

#game_status, #initialize

Constructor Details

This class inherits a constructor from SpaceInvaders::Base

Instance Method Details

#invader_bullet_soundObject



17
18
19
# File 'lib/space_invaders/statics/sounds.rb', line 17

def invader_bullet_sound
  @invader_bullet_sound ||= Gosu::Sample.new(app, asset_path('InvaderBullet'))
end

#invader_hit_soundObject



13
14
15
# File 'lib/space_invaders/statics/sounds.rb', line 13

def invader_hit_sound
  @invader_hit_sound ||= Gosu::Sample.new(app, asset_path('InvaderHit'))
end

#play_invader_fire!Object



33
34
35
# File 'lib/space_invaders/statics/sounds.rb', line 33

def play_invader_fire!
  invader_bullet_sound.play volume=0.05
end

#play_invader_hit!Object



29
30
31
# File 'lib/space_invaders/statics/sounds.rb', line 29

def play_invader_hit!
  invader_hit_sound.play volume=0.5
end

#play_ship_fire!Object



25
26
27
# File 'lib/space_invaders/statics/sounds.rb', line 25

def play_ship_fire!
  ship_bullet_sound.play volume=0.05
end

#play_ship_hit!Object



21
22
23
# File 'lib/space_invaders/statics/sounds.rb', line 21

def play_ship_hit!
  ship_hit_sound.play volume=0.5
end

#ship_bullet_soundObject



9
10
11
# File 'lib/space_invaders/statics/sounds.rb', line 9

def ship_bullet_sound
  @ship_bullet_sound ||= Gosu::Sample.new(app, asset_path('ShipBullet'))
end

#ship_hit_soundObject



5
6
7
# File 'lib/space_invaders/statics/sounds.rb', line 5

def ship_hit_sound
  @ship_hit_sound ||= Gosu::Sample.new(app, asset_path('ShipHit'))
end