summaryrefslogtreecommitdiffhomepage
path: root/not
diff options
context:
space:
mode:
Diffstat (limited to 'not')
-rw-r--r--not/Hero.lua19
-rw-r--r--not/Player.lua1
2 files changed, 7 insertions, 13 deletions
diff --git a/not/Hero.lua b/not/Hero.lua
index ff07c36..d9b0636 100644
--- a/not/Hero.lua
+++ b/not/Hero.lua
@@ -3,8 +3,6 @@
-- Collision category: [2]
Hero = require "not.PhysicalBody":extends()
--- Combat
-Hero.punchdir = 0 -- a really bad thing
-- Movement
Hero.jumpTimer = 0.16
Hero.jumpCounter = 2
@@ -127,17 +125,14 @@ function Hero:update (dt)
end
-- Stop vertical
- local c,a = self.current, self.animations
- if (c == a.attack_up or c == a.attack_down or c == a.attack) and self.frame < c.frames then
- if self.punchdir == 0 then
- self:setLinearVelocity(0,0)
- else
- self:setLinearVelocity(38*self.facing,0)
+ local currentAnimation = self:getAnimation()
+ if self.frame < currentAnimation.frames then
+ if currentAnimation == self.animations.attack_up or currentAnimation == self.animations.attack_down then
+ self:setLinearVelocity(0, 0)
+ end
+ if currentAnimation == self.animations.attack then
+ self:setLinearVelocity(38*self.facing, 0)
end
- end
-
- if self.punchCooldown <= 0 and self.punchdir == 1 then
- self.punchdir = 0
end
end
diff --git a/not/Player.lua b/not/Player.lua
index 11461d3..b0dac75 100644
--- a/not/Player.lua
+++ b/not/Player.lua
@@ -122,7 +122,6 @@ function Player:controlpressed (set, action, key)
else
self:punch("left")
end
- self.punchdir = 1
end
end
end