Permalink
Browse files

play some sound effects

  • Loading branch information...
1 parent f496bc1 commit 39ac68bbf6e9b88c823330a0796c008893458987 @leafo committed Dec 16, 2012
View
@@ -118,6 +118,13 @@ class MachineGun extends Gun
sprite: "38,12,6,3"
size: 1
+ on_hit: (...) =>
+ sfx\play "hit1"
+ super ...
+
+ spawn_bullet: (...) =>
+ sfx\play "machine-gun"
+ super ...
class TankGun extends Gun
recoil_1: 0.1
View
@@ -19,7 +19,7 @@ import cos,sin,abs from math
p = (str, ...) -> g.print str\lower!, ...
export fonts = {}
-export sprite, dispatch
+export sprite, dispatch, sfx
local snapper
local Game
@@ -145,6 +145,9 @@ class Title
@shroud_alpha = 0
@colors = ColorSeparate!
+ onload: =>
+ sfx\play_music "xmoon-title"
+
draw: =>
@colors\render ->
@viewport\apply!
@@ -191,6 +194,9 @@ class Game
@player = Player 100, 100, @
@world = World @player
+ onload: =>
+ sfx\play_music "xmoon"
+
draw: => @world\draw!
update: (dt) =>
return if dt > 0.5
@@ -240,6 +246,14 @@ love.load = ->
g.setFont fonts.main
+ export sfx = lovekit.audio.Audio "sounds"
+ sfx\preload {
+ "machine-gun"
+ "hit1"
+ "boom"
+ "energy-collect"
+ }
+
dispatch = Dispatcher Title!
dispatch\bind love
View
@@ -27,7 +27,7 @@ class NumberParticle extends Particle
@accel = Vec2d 0, 400
@dr = (random! - 0.5) * @spread
-
+
draw: =>
p = @p!
a = linear_step p, 255, 0, 0.5
@@ -138,6 +138,7 @@ class Explosion extends Sequence
new: (@world, x, y) =>
super ->
+ sfx\play "boom"
@world.particles\add @.Fire x, y
@world.particles\add @.Flare x, y
View
@@ -20,6 +20,7 @@ class Energy extends Box
super x,y, @size, @size
on_collect: (world) =>
+ sfx\play "energy-collect"
world.particles\add EnergyEmitter world, @center!
world.energy_count += 1
@alive = false
View
Binary file not shown.
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.

0 comments on commit 39ac68b

Please sign in to comment.