From 257f1f29c317bf7898302837bc925a4be8c83752 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Sat, 27 Nov 2021 13:20:32 +0100 Subject: [PATCH] fix: make the shot bouton lock the player angle --- .../game/modules/subgames/world/actors/player/init.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sonic-bluestreak.love/game/modules/subgames/world/actors/player/init.lua b/sonic-bluestreak.love/game/modules/subgames/world/actors/player/init.lua index 765546e..be3be60 100644 --- a/sonic-bluestreak.love/game/modules/subgames/world/actors/player/init.lua +++ b/sonic-bluestreak.love/game/modules/subgames/world/actors/player/init.lua @@ -39,9 +39,10 @@ function Player:updateStart(dt) self.zsp = 280*1.33 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) end + self.weapons:update(dt) end function Player:basicMovements() @@ -83,7 +84,10 @@ function Player:basicMovementsFree() if (xsp ~= 0 or ysp ~= 0) then 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) end end @@ -105,7 +109,6 @@ end function Player:setAnimation() local gsp = utils.math.pointDistance(0, 0, self.xsp, self.ysp) self.sprite:setCustomSpeed(math.abs(gsp) / 12) - self:setDirection(self.xsp) if (self.action == "punching") then --the animation system is already active else