removing unnecssary score pending
This commit is contained in:
parent
eb1a82d1f3
commit
409800a54f
1 changed files with 1 additions and 7 deletions
|
|
@ -7,7 +7,6 @@ function Cleaver:new()
|
||||||
instance.images = {}
|
instance.images = {}
|
||||||
instance.state = "idle"
|
instance.state = "idle"
|
||||||
instance.timer = 0
|
instance.timer = 0
|
||||||
instance.scorePending = false
|
|
||||||
instance.score = 0
|
instance.score = 0
|
||||||
return instance
|
return instance
|
||||||
end
|
end
|
||||||
|
|
@ -35,10 +34,6 @@ function Cleaver:update(dt)
|
||||||
self.state = "idle"
|
self.state = "idle"
|
||||||
self.currentImage = self.images.idle
|
self.currentImage = self.images.idle
|
||||||
self.timer = 0
|
self.timer = 0
|
||||||
if self.scorePending then
|
|
||||||
self.score = self.score + 1
|
|
||||||
self.scorePending = false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -57,7 +52,6 @@ function Cleaver:mousepressed(button)
|
||||||
self.state = "windup"
|
self.state = "windup"
|
||||||
self.currentImage = self.images.windup
|
self.currentImage = self.images.windup
|
||||||
self.timer = 0
|
self.timer = 0
|
||||||
self.scorePending = false
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -67,13 +61,13 @@ function Cleaver:mousereleased(button)
|
||||||
self.state = "chop"
|
self.state = "chop"
|
||||||
self.currentImage = self.images.chop
|
self.currentImage = self.images.chop
|
||||||
self.timer = 0
|
self.timer = 0
|
||||||
self.scorePending = true
|
|
||||||
-- Check if the cleaver is hovering over a meat instance
|
-- Check if the cleaver is hovering over a meat instance
|
||||||
local x, y = love.mouse.getPosition()
|
local x, y = love.mouse.getPosition()
|
||||||
for i, meat in ipairs(instances.meats) do
|
for i, meat in ipairs(instances.meats) do
|
||||||
if x >= meat.x and x <= meat.x + meat.currentImage:getWidth() and y >= meat.y and y <= meat.y + meat.currentImage:getHeight() then
|
if x >= meat.x and x <= meat.x + meat.currentImage:getWidth() and y >= meat.y and y <= meat.y + meat.currentImage:getHeight() then
|
||||||
-- Remove the meat instance from the table
|
-- Remove the meat instance from the table
|
||||||
table.remove(instances.meats, i)
|
table.remove(instances.meats, i)
|
||||||
|
self.score = self.score + 1
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue