class SpaceInvaders::Sounds

Constants

ABSOLUTE_SOUNDS_PATH
RELATIVE_SOUNDS_PATH

Public Instance Methods

invader_bullet_sound() click to toggle source
# 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_sound() click to toggle source
# 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!() click to toggle source
# File lib/space_invaders/statics/sounds.rb, line 33
def play_invader_fire!
  invader_bullet_sound.play volume=0.05
end
play_invader_hit!() click to toggle source
# File lib/space_invaders/statics/sounds.rb, line 29
def play_invader_hit!
  invader_hit_sound.play volume=0.5
end
play_ship_fire!() click to toggle source
# File lib/space_invaders/statics/sounds.rb, line 25
def play_ship_fire!
  ship_bullet_sound.play volume=0.05
end
play_ship_hit!() click to toggle source
# File lib/space_invaders/statics/sounds.rb, line 21
def play_ship_hit!
  ship_hit_sound.play volume=0.5
end
ship_bullet_sound() click to toggle source
# 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_sound() click to toggle source
# File lib/space_invaders/statics/sounds.rb, line 5
def ship_hit_sound
  @ship_hit_sound ||= Gosu::Sample.new(app, asset_path('ShipHit'))
end

Private Instance Methods

asset_path(sound_name) click to toggle source
# File lib/space_invaders/statics/sounds.rb, line 43
def asset_path(sound_name)
  File.join(ABSOLUTE_SOUNDS_PATH, "#{sound_name}.wav")
end