Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
An example of movement for the player including gravity.
function move_player(p)
local mspd = p.mvspd
if (btn(0)) then p.dx=-mspd end
if (btn(1)) then p.dx=mspd end
-- jump function
jump(p)
-- process gravity
p.dy+=gravity
-- apply physics
p.x += p.dx
p.y += p.dy
p.dx = 0
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment