diff --git a/cleaver.lua b/cleaver.lua index 0ca5333..2857be2 100644 --- a/cleaver.lua +++ b/cleaver.lua @@ -7,7 +7,6 @@ function Cleaver:new() instance.images = {} instance.state = "idle" instance.timer = 0 - instance.scorePending = false instance.score = 0 return instance end @@ -35,10 +34,6 @@ function Cleaver:update(dt) self.state = "idle" self.currentImage = self.images.idle self.timer = 0 - if self.scorePending then - self.score = self.score + 1 - self.scorePending = false - end end end end @@ -57,7 +52,6 @@ function Cleaver:mousepressed(button) self.state = "windup" self.currentImage = self.images.windup self.timer = 0 - self.scorePending = false end end @@ -67,13 +61,13 @@ function Cleaver:mousereleased(button) self.state = "chop" self.currentImage = self.images.chop self.timer = 0 - self.scorePending = true -- Check if the cleaver is hovering over a meat instance local x, y = love.mouse.getPosition() 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 -- Remove the meat instance from the table table.remove(instances.meats, i) + self.score = self.score + 1 break end end