summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-07-18 06:39:05 +0200
committerAki <nthirtyone@gmail.com>2017-07-18 06:39:05 +0200
commitb6aad58259b1e71913280d30e2c9dbf4ecf264c3 (patch)
treeb127adb3025559dc23f2d66cdd8758a68ce711b1
parent7ad366dcec68c703499e3f6f72b345d1adeac1da (diff)
downloadroflnauts-b6aad58259b1e71913280d30e2c9dbf4ecf264c3.zip
roflnauts-b6aad58259b1e71913280d30e2c9dbf4ecf264c3.tar.gz
roflnauts-b6aad58259b1e71913280d30e2c9dbf4ecf264c3.tar.bz2
Removed obsolete punchdir and reworked physical animations on punches
-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