I'm new to LUA and I'm making a simple game where a bunny should bounce after pressing space on the keyboard. So the plan is to make the bunny go up by 30, wait for half a second and then for the bunny to go back to its original position.
That's the code that I've tried so far, and for the looks of it, the love.keypressed function completely ignored the wait function and tried to execute everything at the same time, which means the bunny simply does not move if the spacebar is pressed. (In other words, is there a way to make the bunny stay in the air for 0.5 seconds after pressing the spacebar and then making it go back to its original position?)
function wait(millisecond)
end
function love.keypressed(key)
if key == "space" then
bunny.y = bunny.y - 30
wait(500);
bunny.y = bunny.y + 30
end
end