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