Browse Source

Merge branch 'master' of https://github.com/bjornswenson/pigeon

Sophia 10 years ago
parent
commit
dfb41d6e18
2 changed files with 10 additions and 15 deletions
  1. 3 1
      person.lua
  2. 7 14
      pigeon.lua

+ 3 - 1
person.lua

@@ -80,7 +80,9 @@ function Person:collideWith(other)
 
   if select(2, self.body:getLinearVelocity()) > 500 and self.state == self.dead then
     if not self.splatted then
-      ctx.sound:play('splat')
+      ctx.sound:play('splat', function(sound)
+        sound:setPitch(.9 + love.math.random() * .2)
+      end)
       ctx.particles:emit('blood', self.body:getX(), self.body:getY(), 8)
       self.splatted = true
       if self.screamSound then

+ 7 - 14
pigeon.lua

@@ -190,12 +190,16 @@ function Pigeon:update()
   self:updateFeet()
 
   if self.body:getX() > ctx.goal.x then
-    self:changeState('idle')
+    if self.state ~= self.idle then
+      self:changeState('idle')
+    end
     self.animation:set('flyLoop')
     if not ctx.hud.win.active then
       ctx.hud:activateWin()
       ctx.sound:play('win')
-      ctx.backgroundSound:setVolume(.1)
+      if not ctx.sound.muted then
+        ctx.backgroundSound:setVolume(.1)
+      end
     end
   end
 end
@@ -483,20 +487,9 @@ function Pigeon.idle:update()
   self:recoverFuel()
   self.animation:set('idle')
 
-  if love.keyboard.isDown('left', 'right') then
+  if love.keyboard.isDown('return') then
     return self:changeState('walk').update(self)
   end
-
-  if love.keyboard.isDown('up') then
-    self:changeState('air')
-  elseif love.keyboard.isDown('down') then
-    self:changeState('peck')
-  elseif love.keyboard.isDown(' ') then
-    self:changeState('laser')
-  else
-    local vx, vy = self.body:getLinearVelocity()
-    self.body:setLinearVelocity(vx / 1.2, vy)
-  end
 end
 
 Pigeon.walk = {}