<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>.gitignore</filename>
    </added>
    <added>
      <filename>sounds/collect.mp3</filename>
    </added>
    <added>
      <filename>sounds/death.mp3</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -222,7 +222,37 @@ class GameBoard
   end
 end
 
+class Sounds
+  def initialize(app)
+    @app = app
+    @sounds = {}
+  end
+
+  def add_sound(sound_name, file_name)
+    @sounds[sound_name] = @app.video(&quot;sounds/#{file_name}&quot;, :top =&gt; 0, :left =&gt; 0)
+  end
+
+  def play(sound_name)
+    stop_all
+    @sounds[sound_name].play
+  end
+
+  def playing?
+    @sounds.find { |sound_name, sound| sound.playing? }
+  end
+
+  def stop_all
+    @sounds.each do |sound_name, sound|
+      sound.stop if sound.playing?
+    end
+  end
+end
+
 Shoes.app do
+  @sounds = Sounds.new self
+  @sounds.add_sound :collect, 'collect.mp3'
+  @sounds.add_sound :death, 'death.mp3'
+
   def setup_game(app)
     app.background '#000'
 
@@ -267,10 +297,12 @@ Shoes.app do
     if @board.food_eaten?
       @board.eat_food
       @score.text = &quot;Score: #{@board.score}&quot;
+      @sounds.play :collect
     elsif @board.crashed_into_brick? or @board.crashed_into_self?
       @snake.dead = true
       @anim.stop
-      banner &quot;Game Over&quot;, :top =&gt; 170, :left =&gt; 120, :stroke =&gt; '#fff', :fill =&gt; '#000'
+      @sounds.play :death
+      banner &quot;Game Over&quot;, :top =&gt; 190, :left =&gt; 180, :stroke =&gt; '#fff', :fill =&gt; '#000', :size =&gt; 32
       para &quot;Press 'r' to play again&quot;, :top =&gt; 250, :left =&gt; 210, :stroke =&gt; '#fff', :fill =&gt; '#000'
     end
   end</diff>
      <filename>snake.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>716ec6f314ac7c6cd96f4b12f87ce7396fd6b4c8</id>
    </parent>
  </parents>
  <author>
    <name>Alex Young</name>
    <email>alex@helicoid.net</email>
  </author>
  <url>http://github.com/alexyoung/snake-shoes/commit/6d8860349b613f52b54c0fdc94fcd2b1cc5b51a0</url>
  <id>6d8860349b613f52b54c0fdc94fcd2b1cc5b51a0</id>
  <committed-date>2009-04-08T03:27:46-07:00</committed-date>
  <authored-date>2009-04-08T03:27:46-07:00</authored-date>
  <message>Added sounds for collecting items and death</message>
  <tree>460245cb7974e26ef9e8869e5066ec91bbb08608</tree>
  <committer>
    <name>Alex Young</name>
    <email>alex@helicoid.net</email>
  </committer>
</commit>
