|
@@ -19,7 +19,6 @@ walls={
|
|
}
|
|
}
|
|
|
|
|
|
config={
|
|
config={
|
|
- coyote_time=3,
|
|
|
|
jump_spd=2.2,
|
|
jump_spd=2.2,
|
|
walk_spd=1.0,
|
|
walk_spd=1.0,
|
|
slide_spd=2.0,
|
|
slide_spd=2.0,
|
|
@@ -40,7 +39,6 @@ player={
|
|
dir=0, -- 0=horizontal, 1=diagonal, 2=vertical
|
|
dir=0, -- 0=horizontal, 1=diagonal, 2=vertical
|
|
slide_timer=-1,
|
|
slide_timer=-1,
|
|
bullets={},
|
|
bullets={},
|
|
- coyote_timer=-1,
|
|
|
|
}
|
|
}
|
|
|
|
|
|
debug={
|
|
debug={
|
|
@@ -77,11 +75,8 @@ function debug:draw()
|
|
line(player.x+4, player.y+4, dx, dy, 1)
|
|
line(player.x+4, player.y+4, dx, dy, 1)
|
|
end
|
|
end
|
|
|
|
|
|
-
|
|
|
|
- local mapx = player.x // 8
|
|
|
|
- local mapy = player.y // 8
|
|
|
|
debug:print("player: "..player.x..", "..player.y)
|
|
debug:print("player: "..player.x..", "..player.y)
|
|
- debug:print("map: "..mapx..", "..mapy..": "..mget(mapx, mapy))
|
|
|
|
|
|
+ debug:print("vy: "..tostring(player.vy))
|
|
|
|
|
|
-- controller
|
|
-- controller
|
|
local cont_x, cont_y = 2, 110
|
|
local cont_x, cont_y = 2, 110
|
|
@@ -146,7 +141,7 @@ function player:update()
|
|
else
|
|
else
|
|
-- jump
|
|
-- jump
|
|
if btn(4) then
|
|
if btn(4) then
|
|
- if (player.coyote_timer > 0 or player.vy==0) and not player.is_jmp then
|
|
|
|
|
|
+ if player.vy == 0 and not player.is_jmp then
|
|
player.vy = -config.jump_spd
|
|
player.vy = -config.jump_spd
|
|
player.is_wlk = 0
|
|
player.is_wlk = 0
|
|
player.is_jmp = true
|
|
player.is_jmp = true
|
|
@@ -190,13 +185,6 @@ function player:update()
|
|
-- gravity, terminal velocity
|
|
-- gravity, terminal velocity
|
|
player.vy = math.min(6.0, player.vy + 0.12)
|
|
player.vy = math.min(6.0, player.vy + 0.12)
|
|
player.spr = player.j_spr
|
|
player.spr = player.j_spr
|
|
- if not player.is_jmp and player.coyote_timer == -1 then
|
|
|
|
- player.coyote_timer = config.coyote_time
|
|
|
|
- elseif player.coyote_timer == 0 then
|
|
|
|
- -- do nothing
|
|
|
|
- else
|
|
|
|
- player.coyote_timer = player.coyote_timer - 1
|
|
|
|
- end
|
|
|
|
end
|
|
end
|
|
|
|
|
|
|
|
|
|
@@ -228,7 +216,6 @@ function player:update()
|
|
player.spr = 256
|
|
player.spr = 256
|
|
end
|
|
end
|
|
end
|
|
end
|
|
- player.coyote_timer = -1
|
|
|
|
end
|
|
end
|
|
|
|
|
|
-- bulletsch
|
|
-- bulletsch
|