This is how my player moves:
if love.keyboard.isDown("right") then
player.x = player.x + player.speed * dt
end
if love.keyboard.isDown("left") then
player.x = player.x - player.speed * dt
end
I want to make it, so when the up or down button is pressed down, stop the player from moving.
You can wrap those if statements in another, using the not
and and
keyword:
if not love.keyboard.isDown("up") and not love.keyboard.isDown("down") then
-- Your left/right movement checks here
end