these are the input bindings.
this is the input handling:
function on_input(self, action_id, action)
--checks if sprint button is held and adjusts speed accordingly
if action_id == hash("sprint") then
if action.pressed then
self.speed = sprint_speed
elseif action.released then
self.speed = reg_speed
end
and then this is some of the atrack script, i dont see anything here that i can change to fix this problem:
if self.attack == true then
local angle = math.atan2(self.dir.y, self.dir.x)
local rot = vmath.quat_rotation_z(angle)
local props = { dir = self.dir }
factory.create("#player attack", nil, rot, props)
self.attacking = true
if self.dir.x > 0 then
anim = hash("attack-r")
elseif self.dir.x < 0 then
anim = hash("attack-l")
elseif self.dir.y > 0 then
anim = hash("attack-b")
elseif self.dir.y < 0 then
anim = hash("attack-f")
end
self.attack = false
self.attacking = false
attack_done = false
end
-- if shift isnt held, move at reg speed
if attack_done == true then
if self.attacking == false then
if self.speed == reg_speed then
if self.dir.x > 0 then
anim = hash("player-right")
self.moving = true
elseif self.dir.x < 0 then
anim = hash("player-left")
self.moving = true
elseif self.dir.y > 0 then
anim = hash("player-back")
self.moving = true
elseif self.dir.y < 0 then
anim = hash("player-front")
self.moving = true
end
-- if sprint button is held move wih increased speed and sprint animations
elseif self.speed == sprint_speed then
if self.dir.x > 0 then
anim = hash("player-right")
self.moving = true
elseif self.dir.x < 0 then
anim = hash("player-left")
self.moving = true
elseif self.dir.y > 0 then
anim = hash("sprint-b")
self.moving = true
elseif self.dir.y < 0 then
anim = hash("sprint-f")
self.moving = true
end