Discord
Login
Community
DARK THEME

Jump

looking for a simple jump button for a platfomer P.S srry loginus for deleting the post when you replied thx tho

as far as I know, you'd do something like this:

init = function()
 player = object
  x = 0
  y = 0
  momentum = 0
 end
end

update = function()
 if player.momentum > 0 then
  player.y += momentum
  player.momentum -= 1
 end
 if keyboard.press.W then
  // can also check if colliding with ground to not jump mid-air
  jump(player)
 end
end

jump = function(object)
 object.momentum = 10
end

thanks. How would you display the sprite because i cant figure that out. plz

  screen.drawSprite("name sprite", x, y, width, height )

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community