0
votes

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.

1
you should mark an answer as accepted if it solved your problem - Oliver

1 Answers

0
votes

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