title screen, sounds
This commit is contained in:
parent
cb85e6ff11
commit
80ecc86b12
155
snowdogs.p8
155
snowdogs.p8
@ -7,12 +7,16 @@ __lua__
|
||||
|
||||
function _init()
|
||||
create_particles()
|
||||
mode = "title"
|
||||
goal = 10000
|
||||
end
|
||||
|
||||
function _update()
|
||||
update_snow()
|
||||
if mode == "title" then
|
||||
update_title()
|
||||
title_upd()
|
||||
elseif mode == "cast" then
|
||||
cast_upd()
|
||||
elseif mode == "game" then
|
||||
sled_upd()
|
||||
trees_upd()
|
||||
@ -21,24 +25,29 @@ end
|
||||
|
||||
function _draw()
|
||||
if mode == "title" then
|
||||
draw_title()
|
||||
title_dr()
|
||||
draw_snow()
|
||||
elseif mode == "cast" then
|
||||
cast_dr()
|
||||
draw_snow()
|
||||
elseif mode == "game" then
|
||||
draw_game()
|
||||
--draw_snow()
|
||||
--draw_hud()
|
||||
draw_snow()
|
||||
draw_hud()
|
||||
--draw_bounds()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function draw_game()
|
||||
function snowbg()
|
||||
cls(6)
|
||||
-- grey transparency
|
||||
palt(0b000001000000000)
|
||||
end
|
||||
|
||||
function draw_game()
|
||||
snowbg()
|
||||
trees_dr()
|
||||
sled_dr()
|
||||
palt()
|
||||
end
|
||||
|
||||
-->8
|
||||
@ -49,7 +58,7 @@ title_rainbow = 0
|
||||
title_susan = -40
|
||||
title_89 = 40
|
||||
|
||||
function update_title()
|
||||
function title_upd()
|
||||
if title_y < 50 then
|
||||
title_y += 1
|
||||
elseif title_stretch < 16 then
|
||||
@ -63,10 +72,16 @@ function update_title()
|
||||
if btnp(4) then
|
||||
mode = "game"
|
||||
end
|
||||
|
||||
if t() > 10 and t() < 16 then
|
||||
mode = "cast"
|
||||
end
|
||||
end
|
||||
|
||||
function draw_title()
|
||||
function title_dr()
|
||||
cls(0)
|
||||
palt()
|
||||
|
||||
|
||||
if title_susan then
|
||||
print("susan butcher's", title_susan, title_susan + 10, 12)
|
||||
@ -81,6 +96,64 @@ function draw_title()
|
||||
70+title_89, 100+title_89,
|
||||
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()
|
||||
print("dogs", 38, 110, 1)
|
||||
sled_dr()
|
||||
|
||||
draw_fan(100, 90)
|
||||
print("the fan", 90, 120)
|
||||
|
||||
draw_tree(110, 0)
|
||||
draw_tree(115, 11)
|
||||
draw_tree(118, 12)
|
||||
draw_siren(110, 20)
|
||||
draw_yeti(111, 40)
|
||||
draw_tree(90, 16)
|
||||
draw_tree(100, 20)
|
||||
draw_tree(110, 24)
|
||||
draw_tree(93, 28)
|
||||
print("yeti", 100, 58)
|
||||
|
||||
draw_tree(20, 20)
|
||||
draw_tree(30, 20)
|
||||
draw_tree(40, 20)
|
||||
draw_moose(41, 30)
|
||||
draw_tree(20, 40)
|
||||
draw_tree(30, 40)
|
||||
draw_tree(40, 40)
|
||||
print("moose", 15, 60)
|
||||
|
||||
end
|
||||
|
||||
function cast_upd()
|
||||
if btnp(4) then
|
||||
mode = "game"
|
||||
end
|
||||
|
||||
if t() > 16 then
|
||||
mode = "title"
|
||||
end
|
||||
end
|
||||
-->8
|
||||
-- snow
|
||||
|
||||
@ -117,9 +190,6 @@ end
|
||||
-->8
|
||||
-- game entities
|
||||
|
||||
goal = 10000
|
||||
mode = "title"
|
||||
|
||||
function draw_hud()
|
||||
rectfill(14,0,114,4,7)
|
||||
local d = 14+distance/goal*100
|
||||
@ -153,7 +223,7 @@ speed = 1
|
||||
distance = 0 -- 10ths of mile
|
||||
sled_x = 64
|
||||
dogs = 6
|
||||
|
||||
mush_time = 0
|
||||
|
||||
function sled_upd()
|
||||
if btn(0) then
|
||||
@ -164,19 +234,23 @@ function sled_upd()
|
||||
steering = 0
|
||||
end
|
||||
|
||||
speed = 1 + (distance / 3000)
|
||||
speed = 1 + (distance / 5000)
|
||||
|
||||
if btnp(4) then
|
||||
speed *= 3
|
||||
if btnp(4) and t() - mush_time > 1 then
|
||||
mush_time = t()
|
||||
sfx(3)
|
||||
--steering = rnd({-2, 2})
|
||||
end
|
||||
|
||||
if t() - mush_time < 0.2 then
|
||||
speed *= 3
|
||||
end
|
||||
|
||||
distance += speed
|
||||
sled_x += steering * speed
|
||||
|
||||
sl, sr = sled_bounds()
|
||||
tl, tr = tree_bounds()
|
||||
--printh(tl.." "..sl..","..sr.." "..tr)
|
||||
if sl < tl or sr > tr then
|
||||
crash()
|
||||
end
|
||||
@ -271,10 +345,11 @@ function trees_upd()
|
||||
end
|
||||
|
||||
function add_next_tree()
|
||||
local pct = (goal - distance) / goal
|
||||
local pct = distance / goal
|
||||
-- TODO: adjust difficulty
|
||||
local minw = 70 + 45 * pct
|
||||
local maxw = 90 - 50 * pct
|
||||
local minw = 70 - (45 * pct)
|
||||
local maxw = 90 - (50 * pct)
|
||||
--printh(pct .. "% "..minw.." "..maxw)
|
||||
local nw = tree_wall[1].w + rnd(8)-4
|
||||
local idx = cur_tree() - 1
|
||||
if idx == 0 then
|
||||
@ -311,27 +386,27 @@ __gfx__
|
||||
000000006dd99dd66dd99ddd77777777666666666664466666707766665555660000000000000000633333366333333600000000664444044444444600000000
|
||||
00000000ddddddddddddddd677677677666666666644446666077766655555560000000000000000333333333333777700000000666440044444444400000000
|
||||
00000000dd2222dddd22222677677677666666666644446666770066655555560000000000000000333333337777733300000000666440444444444400000000
|
||||
00000000dd2222dddd22222677677667666666666644446666770766655555560000000000000000666446666664466600000000666666444444444600000000
|
||||
00000000dd2222dddd222226cc67766c666666666644446666770766655555560000000000000000666446666664466600000000666666444444444600000000
|
||||
00000000dd2222dddd22222666677766666666666644446666077766655555560000000000000000666446666664466600000000666666446666644600000000
|
||||
00000000dd2222dddd22222666777776666666666644446666077766655555560000000000000000666446666664466600000000666666446666644600000000
|
||||
00000000d222222dd222222667777776666666666644446666677666665555660000000000000000666446666664466600000000666666446666644600000000
|
||||
00000000622222266222222667777776666666666664466666607666666556660000000000000000666446666664466600000000666666046666604600000000
|
||||
00000000622222266666666666666666666666660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000622662266666666666666666666666660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000622662266666666666666666666666660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000622662266666666666666666666666660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000622662266666666666666666666666660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000622662266666666666666666666666660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000666666666666666666666666666666660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000666666666666666666666666666666660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000666666666666666666666666000000000000000066660666600066660666600066000666666000066000666600000000080000000000000000000000
|
||||
00000000666666666666666666666666000000000000000066660666660066660666600600600660000600666600666660000000800888800088880000000000
|
||||
00000000666666666666666666666666000000000000000006600660066006600066006600660660000606600660660066000000008000080000008000000000
|
||||
00000000666666666666666666666666000000000000000006600660006006600066006600660666666606600660660006000000008000080000008000000000
|
||||
00000000666666666666666666666666000000000000000006600660006006600066006666660666660006600660660006000000000888800088888000000000
|
||||
00000000666666666666666666666666000000000000000006600660066006600066006600660660660006600660660066000000008000080000008000000000
|
||||
00000000666666666666666666666666000000000000000066660666660066660066006600660660066000666600666660000000008000080000008000000000
|
||||
00000000666666666666666666666666000000000000000066660666600066660066006600660660006600066000666600000000000888800088880000000000
|
||||
00000000622222266222222667c7c7c6666666666664466666607666666556660000000000000000666446666664466600000000666666046666604600000000
|
||||
00000000622222266666666677666666666666660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000622662266666666677766666666666660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000622662266666666671776666688688660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000622662266666666677776666888888860000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000622662266666666688776666688888660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000622662266666666677876666668886660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000666666666666666676666566666866660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000666666666666666677765566666666660000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
00000000666666666666666677677566669999660000000077770777700077770777700077000677677000077000777700000000080000000000000000000000
|
||||
0000000066666666666666667777766669aaaa960000000066660666670066670666700600700660000700766700666670000000800888800088880000000000
|
||||
000000006666666666666666577776669aa99aa90000000006600660067006600066006600670660000706600670660067000000008000080000008000000000
|
||||
000000006666666666666666577766669aaa9aa90000000006600660006006600066006600660666666606600660660006000000008000080000008000000000
|
||||
000000006666666666666666777666669aaa9aa90000000006600660006006600066006667660666660006600660660006000000000888800088888000000000
|
||||
000000006666666666666666777666669aa999a90000000006600660066006600066006600660660660006600660660066000000008000080000008000000000
|
||||
0000000066666666666666666776666669aaaa960000000066660667760066670066006600660660066000666600666660000000008000080000008000000000
|
||||
00000000666666666666666665566666669999660000000066660666600066660066006600660660006600066000666600000000000888800088880000000000
|
||||
__label__
|
||||
00000000000000700000000007000070000000700000000000000700000000000000000000000000000000000000000000000000007000000000000000000007
|
||||
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
@ -469,9 +544,9 @@ __map__
|
||||
0000000000000000010101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
__sfx__
|
||||
000f00001d0501f0502203024030270302703027030220302203022030240302703027030240302203024030290302903027030240302203024030290302b030270302403022030290302b0302b0302703022030
|
||||
310f00001340227402274022953227402274022740229532004020000200002295320000200002295322953200002000020000229532000020000200002295320000200002000022953200002000022953229532
|
||||
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
300f00001340227402274022953227402274022740229532004020000200002295320000200002295322953200002000020000229532000020000200002295320000200002000022953200002000022953229532
|
||||
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
0102000000107001070010700107001070a1570a1570a1570a1570a1570a1570a1570c1570c1570f1570f157111571315716157181571b1571d1571f1571f1571d15700107001070010700107001070010700107
|
||||
0004000000600006000060000600186501d65022650276502b6502f6502f6502c6502c6502c6502b6502b6502965027650236501e6501c6500060000600006000060000600006000060000600006000060000600
|
||||
__music__
|
||||
00 00014344
|
||||
|
Loading…
Reference in New Issue
Block a user