When I use isDown, depending on the duration of pressing the key, the game skips the next scene.
Example:
Code: Select all
function update_forest(dt)
if love.keyboard.isDown('right') then
scene = 'waterfall'
end
if love.keyboard.isDown('left') then
scene = 'cabin'
end
end
function update_waterfall(dt)
if love.keyboard.isDown('left') then
scene = 'forest'
end
end
function update_cabin(dt)
if love.keyboard.isDown('right') then
scene = 'forest'
end
end
I know that keypressed or wasPressed can solve my case, but I don't know how to implement this. I also know that there are better ways to write this code, but I'm new to LOVE2D and I'd like to continue in this more amateur way for now...
All help will be appreciated!