|
@@ -27,36 +27,63 @@ local jumpMaxHeight = 20
|
|
local jumpVariableHeight = true
|
|
local jumpVariableHeight = true
|
|
local jumpGravity = 0.7
|
|
local jumpGravity = 0.7
|
|
|
|
|
|
-function visualizeJumpParams()
|
|
|
|
- circ(10, 100, 2, 5)
|
|
|
|
- for xpos=1,100 do
|
|
|
|
- ypos=0
|
|
|
|
- end
|
|
|
|
-end
|
|
|
|
|
|
+local player = {
|
|
|
|
+ x = 10, y = 80,
|
|
|
|
+ vx = 0, vy = 0,
|
|
|
|
+ jump = 2.3,
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+local gravity = -0.07
|
|
|
|
|
|
function TIC()
|
|
function TIC()
|
|
|
|
+ movePlayer()
|
|
|
|
|
|
- if btn(0) then y=y-1 end
|
|
|
|
- if btn(1) then y=y+1 end
|
|
|
|
- if btn(2) then x=x-1 end
|
|
|
|
- if btn(3) then x=x+1 end
|
|
|
|
|
|
+ cls(0)
|
|
|
|
+ drawPlayer()
|
|
|
|
|
|
- cls(13)
|
|
|
|
- print("HELLO WORLD!",84,84)
|
|
|
|
t=t+1
|
|
t=t+1
|
|
end
|
|
end
|
|
|
|
|
|
|
|
+function movePlayer()
|
|
|
|
+ -- if btn(0) then player.y=player.y-1 end
|
|
|
|
+ -- if btn(1) then player.y=player.y+1 end
|
|
|
|
+ if btn(2) then
|
|
|
|
+ player.vx = math.min(-runMaxSpeed, player.vx - runAccel)
|
|
|
|
+ end
|
|
|
|
+ if btn(3) then
|
|
|
|
+ player.vx = math.max(runMaxSpeed, player.vx + runAccel)
|
|
|
|
+ end
|
|
|
|
+
|
|
|
|
+ if player.vy == 0 and btnp(4) then
|
|
|
|
+ player.vy = -player.jump
|
|
|
|
+ end
|
|
|
|
+
|
|
|
|
+ -- friction and gravity
|
|
|
|
+ player.x = player.x + player.vx
|
|
|
|
+ player.vx = player.vx * runDecel
|
|
|
|
+
|
|
|
|
+ player.vy = player.vy - gravity
|
|
|
|
+ player.y = player.y + player.vy
|
|
|
|
+
|
|
|
|
+ if player.y > 130 then
|
|
|
|
+ player.y = 130
|
|
|
|
+ player.vy = 0
|
|
|
|
+ end
|
|
|
|
+end
|
|
|
|
+
|
|
|
|
+function drawPlayer()
|
|
|
|
+ rect(player.x, player.y, 8, 8, 7)
|
|
|
|
+end
|
|
|
|
+
|
|
-- <TILES>
|
|
-- <TILES>
|
|
--- 001:eccccccccc888888caaaaaaaca888888cacccccccacc0ccccacc0ccccacc0ccc
|
|
|
|
--- 002:ccccceee8888cceeaaaa0cee888a0ceeccca0ccc0cca0c0c0cca0c0c0cca0c0c
|
|
|
|
--- 003:eccccccccc888888caaaaaaaca888888cacccccccacccccccacc0ccccacc0ccc
|
|
|
|
--- 004:ccccceee8888cceeaaaa0cee888a0ceeccca0cccccca0c0c0cca0c0c0cca0c0c
|
|
|
|
--- 017:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
|
|
|
|
--- 018:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
|
|
|
|
--- 019:cacccccccaaaaaaacaaacaaacaaaaccccaaaaaaac8888888cc000cccecccccec
|
|
|
|
--- 020:ccca00ccaaaa0ccecaaa0ceeaaaa0ceeaaaa0cee8888ccee000cceeecccceeee
|
|
|
|
|
|
+-- 001:5555555566666666222222222222222222222222222222222222222222222222
|
|
|
|
+-- 002:5555555066666665222222262222222022222220222222202222222022222220
|
|
-- </TILES>
|
|
-- </TILES>
|
|
|
|
|
|
|
|
+-- <MAP>
|
|
|
|
+-- 015:101010101010101010101010101010101010101010101010101010101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
|
|
+-- </MAP>
|
|
|
|
+
|
|
-- <WAVES>
|
|
-- <WAVES>
|
|
-- 000:00000000ffffffff00000000ffffffff
|
|
-- 000:00000000ffffffff00000000ffffffff
|
|
-- 001:0123456789abcdeffedcba9876543210
|
|
-- 001:0123456789abcdeffedcba9876543210
|
|
@@ -67,6 +94,10 @@ end
|
|
-- 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
|
|
-- 000:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000304000000000
|
|
-- </SFX>
|
|
-- </SFX>
|
|
|
|
|
|
|
|
+-- <FLAGS>
|
|
|
|
+-- 000:00202000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
|
|
|
+-- </FLAGS>
|
|
|
|
+
|
|
-- <PALETTE>
|
|
-- <PALETTE>
|
|
-- 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
|
|
-- 000:1a1c2c5d275db13e53ef7d57ffcd75a7f07038b76425717929366f3b5dc941a6f673eff7f4f4f494b0c2566c86333c57
|
|
-- </PALETTE>
|
|
-- </PALETTE>
|