Log In  

Cart #19382 | 2016-03-24 | Code ▽ | Embed ▽ | No License

This is an Test.
Controls:

Arrow LEFT/RIGHT : Move
Arrow UP : Jump
Jump again in air : Double-Jump

P#19383 2016-03-24 10:14 ( Edited 2016-03-24 16:16)

Good! A few notes:

  • Instead of simply adding the player's x or y for a bit, try this:
    1. Initiate the new variables.
dx = 0
 dy = 0
 jump = 2
  1. Let's work on moving.
if(btn(0,0))then
  dx = -1.5
elseif(btn(1,0))then
  dx = 1.5
else
  if(dx > 0)then
   dx -= 0.5
  end
end
x = x + dx
  1. While we're doing it, let's jump too!
if(btn(4,0)) or (btn(5,0)) then
  if(jump > 0)then
    dy += 5
    jump -= 1
  end
end
if(y > 120)then
  dy -= 0.5
else
  dy = 0
  y = 120
  jump = 2
end
y = y + dy

Brand new code!

P#19385 2016-03-24 12:16 ( Edited 2016-03-24 16:19)

[Please log in to post a comment]

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-12-16 00:03 | 0.019s | 2097k | Q:26