fix collision
This commit is contained in:
parent
9521f949f3
commit
adcc8d87b4
66
snowdogs.p8
66
snowdogs.p8
@ -35,7 +35,7 @@ function _draw()
|
|||||||
draw_game()
|
draw_game()
|
||||||
draw_snow()
|
draw_snow()
|
||||||
draw_hud()
|
draw_hud()
|
||||||
--draw_bounds()
|
draw_bounds()
|
||||||
elseif mode == "gameover" then
|
elseif mode == "gameover" then
|
||||||
draw_flag()
|
draw_flag()
|
||||||
end
|
end
|
||||||
@ -100,23 +100,6 @@ function title_dr()
|
|||||||
48, 48)
|
48, 48)
|
||||||
end
|
end
|
||||||
|
|
||||||
function draw_fan(x, y)
|
|
||||||
spr(flr(1+(t() % 2)), x, y, 1, 2, flr(t()) % 3 == 1)
|
|
||||||
spr(33, x, y+16)
|
|
||||||
end
|
|
||||||
|
|
||||||
function draw_yeti(x, y)
|
|
||||||
spr(35, x, y, 1, 2)
|
|
||||||
spr(35, x-8, y, 1, 2, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
function draw_siren(x, y)
|
|
||||||
spr(3, x, y, 1, 2)
|
|
||||||
end
|
|
||||||
|
|
||||||
function draw_moose(x, y)
|
|
||||||
spr(13, x, y, 2, 2, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
function cast_dr()
|
function cast_dr()
|
||||||
snowbg()
|
snowbg()
|
||||||
@ -277,7 +260,9 @@ function crash()
|
|||||||
if dogs == 0 then
|
if dogs == 0 then
|
||||||
mode = "gameover"
|
mode = "gameover"
|
||||||
end
|
end
|
||||||
sled_x = tree_wall[8].l + tree_wall[8].w / 2
|
local ti = (cur_tree() + 8) % #tree_wall + 1
|
||||||
|
l, r = tree_bounds()
|
||||||
|
sled_x = (l + r) / 2
|
||||||
end
|
end
|
||||||
|
|
||||||
function sled_dr()
|
function sled_dr()
|
||||||
@ -321,7 +306,7 @@ function screenx(x)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function cur_tree()
|
function cur_tree()
|
||||||
--
|
-- tree at top of screen right now (cycles)
|
||||||
return #tree_wall - flr((distance / 16) % #tree_wall)
|
return #tree_wall - flr((distance / 16) % #tree_wall)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -370,12 +355,43 @@ function tree_bounds()
|
|||||||
-- return left, right
|
-- return left, right
|
||||||
-- use wall based on dogs
|
-- use wall based on dogs
|
||||||
-- remaining
|
-- remaining
|
||||||
w = {8, 8, 7, 7, 6, 6}
|
local ti = cur_tree()
|
||||||
w = w[dogs]
|
if dogs >= 5 then
|
||||||
l = tree_wall[w].l
|
ti += 5
|
||||||
-- middle of tree is bound
|
elseif dogs >= 3 then
|
||||||
return l+8, l+tree_wall[w].w+8
|
ti += 6
|
||||||
|
else
|
||||||
|
ti += 7
|
||||||
end
|
end
|
||||||
|
if ti > #tree_wall then
|
||||||
|
ti -= #tree_wall
|
||||||
|
end
|
||||||
|
l = tree_wall[ti].l
|
||||||
|
-- middle of tree is bound
|
||||||
|
return l+8, l+tree_wall[ti].w+8
|
||||||
|
end
|
||||||
|
|
||||||
|
-->8
|
||||||
|
--npcs
|
||||||
|
|
||||||
|
function draw_fan(x, y)
|
||||||
|
spr(flr(1+(t() % 2)), x, y, 1, 2, flr(t()) % 3 == 1)
|
||||||
|
spr(33, x, y+16)
|
||||||
|
end
|
||||||
|
|
||||||
|
function draw_yeti(x, y)
|
||||||
|
spr(35, x, y, 1, 2)
|
||||||
|
spr(35, x-8, y, 1, 2, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
function draw_siren(x, y)
|
||||||
|
spr(3, x, y, 1, 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
function draw_moose(x, y)
|
||||||
|
spr(13, x, y, 2, 2, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-->8
|
-->8
|
||||||
--end screens
|
--end screens
|
||||||
|
Loading…
Reference in New Issue
Block a user