improvement(game/world): remove non-supported actions

This commit is contained in:
Kazhnuz 2019-10-13 17:49:44 +02:00
parent b8d188be34
commit 3b3ae3e690

View file

@ -19,44 +19,30 @@ end
function Player:updateStart(dt) function Player:updateStart(dt)
self.xfrc, self.yfrc = 480*3, 480*3 self.xfrc, self.yfrc = 480*3, 480*3
if self.keys["up"].isDown and (self.action ~= "punching") then if self.keys["up"].isDown then
self.ysp = -160 self.ysp = -160
end end
if self.keys["down"].isDown and (self.action ~= "punching") then if self.keys["down"].isDown then
self.ysp = 160 self.ysp = 160
end end
if self.keys["left"].isDown and (self.action ~= "punching") then if self.keys["left"].isDown then
self.xsp = -160 self.xsp = -160
end end
if self.keys["right"].isDown and (self.action ~= "punching") then if self.keys["right"].isDown then
self.xsp = 160 self.xsp = 160
end end
if self.keys["A"].isDown and (self.onGround) and (self.action ~= "punching") then if self.keys["A"].isDown and (self.onGround) then
self.zsp = 280*1.33 self.zsp = 280*1.33
end end
if self.keys["B"].isPressed and (self.onGround) then if self.keys["B"].isPressed and (self.onGround) then
self.action = "punching" -- Nothing for the moment
--self.xsp = 0
--self.ysp = 0
if self:getCurrentAnimation() == "hit1" then
self:changeAnimation("hit2", true)
elseif self:getCurrentAnimation() == "hit2" then
self:changeAnimation("hit3", true)
elseif self:getCurrentAnimation() == "hit3" then
--self:changeAnimation("hit1", true)
else
self:changeAnimation("hit1", true)
end
end end
end end
function Player:animationEnded(name) function Player:animationEnded(name)
if (name == "hit1") or (name == "hit2") or (name == "hit3") then
self.action = "normal"
end
end end
function Player:updateEnd(dt) function Player:updateEnd(dt)