Browse Source

More points for peck;

bjorn 10 years ago
parent
commit
21836d0ad4
3 changed files with 11 additions and 7 deletions
  1. 6 2
      hud.lua
  2. 4 4
      person.lua
  3. 1 1
      pigeon.lua

+ 6 - 2
hud.lua

@@ -168,6 +168,7 @@ end
 function Hud:resetBubble()
   self.bubble.active = false
   self.bubble.amount = 0
+  self.bubble.amountDisplay = self.bubble.amount
   self.bubble.timer = 0
   self.bubble.multiplier = 0
   self.bubble.targetY = 200
@@ -179,11 +180,10 @@ function Hud:resetBubble()
   self.rainbowShitCounter = 0
 end
 
-function Hud:addScore(amount, kind)
+function Hud:addScore(amount, kind, cause)
   self.bubble.active = true
   self.bubble.timer = 3
   self.bubble.amount = self.bubble.amount + amount
-  self.bubble.amountDisplay = self.bubble.amount
   self.bubble.multiplier = self.bubble.multiplier + 1
   self.bubble.scale = self.bubble.scale + .2
   self.bubble.targetScale = self.bubble.targetScale + .1
@@ -196,6 +196,10 @@ function Hud:addScore(amount, kind)
       --self.rainbowShitCounter = 0
       ctx.pigeon:activateRainbowShit()
     end
+
+    if cause == 'peck' then
+      self.bubble.amount = self.bubble.amount + 5
+    end
   end
 end
 

+ 4 - 4
person.lua

@@ -107,11 +107,11 @@ function Person:distanceTo(object)
   return math.abs(object.body:getX() - self.body:getX())
 end
 
-function Person:changeState(target)
+function Person:changeState(target, ...)
   if self.state == target then return end
   f.exe(self.state.exit, self)
   self.state = self[target]
-  f.exe(self.state.enter, self)
+  f.exe(self.state.enter, self, ...)
   return self.state
 end
 
@@ -119,14 +119,14 @@ end
 -- Base States
 ----------------
 Person.dead = {}
-function Person.dead:enter()
+function Person.dead:enter(cause)
   ctx.hud.deathBulge = ctx.hud.deathBulge + 1
   self.body:setFixedRotation(false)
   self.fixture:setCategory(ctx.categories.debris)
   self.fixture:setFriction(0.25)
   self.body:applyLinearImpulse(-200 + love.math.random() * 400, -200 + love.math.random() * -500)
   self.body:setAngularVelocity(-20 + love.math.random() * 40)
-  ctx.hud:addScore(10, 'person')
+  ctx.hud:addScore(10, 'person', cause)
   if self.gender == 'male' and love.math.random() < .75 then
     self.screamSound = ctx.sound:play('scream2', function(sound)
       sound:setVolume(.75)

+ 1 - 1
pigeon.lua

@@ -251,7 +251,7 @@ end
 function Pigeon:collideWith(other, myFixture)
   if isa(other, Person) and other.state ~= other.dead and other.invincible == 0 then
     if self.state == self.peck and (myFixture == self.beak.top.fixture or myFixture == self.beak.bottom.fixture) then
-      other:changeState('dead')
+      other:changeState('dead', 'peck')
     elseif self.state == self.walk and self.drop and myFixture == self.feet[self.drop].fixture then
       other:changeState('dead')
     elseif self.crushGrace > 0 and (myFixture == self.feet.left.fixture or myFixture == self.feet.right.fixture) then