Skip to content

Commit

Permalink
bird death
Browse files Browse the repository at this point in the history
  • Loading branch information
muselesscreator committed May 14, 2014
1 parent 0974a71 commit 6e0107a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
21 changes: 18 additions & 3 deletions FarmGame/Classes/FarmElement.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ function FarmElement:initialize(args)
theField.slingAnim:setSequence('SlingAnim')
theField.slingAnim.alpha = 1
theField.slingAnim:play()
local killed_pest = false
timer.performWithDelay(1000, function()
theField.slingAnim.alpha = 0
theField.slingAnim:setSequence('SlingAnim')
Expand All @@ -48,6 +49,7 @@ function FarmElement:initialize(args)
local pest = theField:pestAt(v.i, v.j)
if pest ~= false then
print('Kill thie Pest!')
killed_pest = true
pest:useWeapon()
else
local other_stuff = theField:whatIsAt(v.i, v.j)
Expand All @@ -58,9 +60,22 @@ function FarmElement:initialize(args)
end
end
timer.performWithDelay(1000, function()
touchesAllowed = true
self:useNext()
theField:nextDay()
if killed_pest == true then
theField.slingAnim:setSequence('BirdDeath')
theField.slingAnim.alpha = 1
theField.slingAnim:play()
timer.performWithDelay(800, function()
theField.slingAnim.alpha = 0
theField.slingAnim:setSequence('SlingAnim')
touchesAllowed = true
self:useNext()
theField:nextDay()
end, 1)
else
touchesAllowed = true
self:useNext()
theField:nextDay()
end
end, 1)
return true
end
Expand Down
2 changes: 1 addition & 1 deletion FarmGame/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ sequenceData =

{ name="Reticle", sheet=weaponSheet, frames={ 1 }},
{ name="SlingAnim", sheet=weaponSheet, start=2, count=19, time=1000},
{ name="BirdDeath", sheet=weaponSheet, start=20, count=7},
{ name="BirdDeath", sheet=weaponSheet, start=20, count=7, time=800},
{ name="Mallet", sheet=weaponSheet, start=27, count=6, time=250, loopCount=1},
{ name="Slingshot", sheet=weaponSheet, frames={33}},

Expand Down

0 comments on commit 6e0107a

Please sign in to comment.