fix: make the shot bouton lock the player angle
This commit is contained in:
parent
5754d93cc5
commit
257f1f29c3
1 changed files with 6 additions and 3 deletions
|
@ -39,9 +39,10 @@ function Player:updateStart(dt)
|
||||||
self.zsp = 280*1.33
|
self.zsp = 280*1.33
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.keys["B"].isPressed then
|
if self.keys["B"].isDown then
|
||||||
self.weapons:shoot(self.x, self.y+1, self.z+8, self.angle)
|
self.weapons:shoot(self.x, self.y+1, self.z+8, self.angle)
|
||||||
end
|
end
|
||||||
|
self.weapons:update(dt)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Player:basicMovements()
|
function Player:basicMovements()
|
||||||
|
@ -83,7 +84,10 @@ function Player:basicMovementsFree()
|
||||||
|
|
||||||
if (xsp ~= 0 or ysp ~= 0) then
|
if (xsp ~= 0 or ysp ~= 0) then
|
||||||
local angle = utils.math.pointDirection(0, 0, xsp, ysp)
|
local angle = utils.math.pointDirection(0, 0, xsp, ysp)
|
||||||
self.angle = angle
|
if not self.keys["B"].isDown then
|
||||||
|
self.angle = angle
|
||||||
|
self:setDirection(xsp)
|
||||||
|
end
|
||||||
self.xsp, self.ysp = utils.math.lengthdir(160, angle)
|
self.xsp, self.ysp = utils.math.lengthdir(160, angle)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -105,7 +109,6 @@ end
|
||||||
function Player:setAnimation()
|
function Player:setAnimation()
|
||||||
local gsp = utils.math.pointDistance(0, 0, self.xsp, self.ysp)
|
local gsp = utils.math.pointDistance(0, 0, self.xsp, self.ysp)
|
||||||
self.sprite:setCustomSpeed(math.abs(gsp) / 12)
|
self.sprite:setCustomSpeed(math.abs(gsp) / 12)
|
||||||
self:setDirection(self.xsp)
|
|
||||||
if (self.action == "punching") then
|
if (self.action == "punching") then
|
||||||
--the animation system is already active
|
--the animation system is already active
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue