a real title screen!

This commit is contained in:
Kistaro Windrider 2024-02-11 16:34:52 -08:00
parent 9e746ce0d0
commit 3070e2ef15
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -1052,27 +1052,48 @@ end
title_screen = {} title_screen = {}
mknew(title_screen, function(t) mknew(title_screen, function(t)
t.d = ditherer.new{ t.a = arcade_level.new{
di = -1 noscore=true,
max_score=9999,
wordwait=9999,
extra_layer={
draw=function()
t:draw_menu()
end,
update=nop,
},
phin_x = 62,
} }
end) end)
function title_screen:activate() function title_screen:activate()
self.a:activate()
font_monogram() font_monogram()
end end
function title_screen:draw() function title_screen:draw()
pal() self.a:draw()
clear_alt_pal_bits() end
cls(12)
print("title screen", 30, 57, 0) function title_screen:draw_menu()
print("press right arrow", 15, 66, 0) font_special()
self.d:draw() print("\^w\^tvACATION", 18, 24, 0)
print("\^w\^tvACATION", 17, 23, 3)
print("\^w\^tvACATION", 16, 22, 15)
print("pRESS", 43, 96, 3)
print("pRESS", 42, 95, 15)
font_default()
print("➡️", 79, 98, 3)
print("➡️", 78, 97, 15)
end end
function title_screen:update() function title_screen:update()
if (btnp(1)) self.d.di = 1 self.a.wordwait=999
if(self.d:update() and self.d.di > 0) start_game() if btnp(1) then
self.a.wordremain=0
create_game()
end
self.a:update()
end end
-->8 -->8
-- dolphin sprite renderer -- dolphin sprite renderer
@ -1150,6 +1171,7 @@ phinstate_error = {
-- many states are off-center. -- many states are off-center.
toyphin = { toyphin = {
x=-12, x=-12,
xtarget=16,
y=64, y=64,
dy=0, dy=0,
state=phinstate_nrm state=phinstate_nrm
@ -1161,7 +1183,7 @@ function toyphin:update()
-- entry mode? -- entry mode?
if not self.entered then if not self.entered then
x += 1 x += 1
self.entered = x >= 16 self.entered = x >= self.xtarget
elseif self.exiting then elseif self.exiting then
if x + self.state.xo > 128 then if x + self.state.xo > 128 then
self.exited = true self.exited = true
@ -1408,7 +1430,10 @@ arcade_level = {
wordwait = 90, wordwait = 90,
} }
mknew(arcade_level, function(x) mknew(arcade_level, function(x)
x.phin = toyphin.new{splasher=x} x.phin = toyphin.new{
splasher=x,
xtarget=x.phin_x,
}
x.sky = bg.new{c=13} x.sky = bg.new{c=13}
x.sea = sea.new() x.sea = sea.new()
x.bg = event_list.new() x.bg = event_list.new()
@ -1423,7 +1448,8 @@ mknew(arcade_level, function(x)
x.sky, x.sky,
x.sea, x.sea,
x.waves, x.waves,
{draw=function() x.noscore and blank or {
draw=function()
poke(0x5f58, 0) poke(0x5f58, 0)
local s = tostr(x.score) local s = tostr(x.score)
print(s,1,2,3) print(s,1,2,3)
@ -1431,24 +1457,25 @@ mknew(arcade_level, function(x)
print(s,0,1,3) print(s,0,1,3)
print(s,1,0,3) print(s,1,0,3)
print(s,1,1,15) print(s,1,1,15)
end}, end
},
x.bg, x.bg,
x.phin, x.phin,
x.fg, x.fg,
x.words, x.words,
x.extra_layer or blank,
} }
x.d = ditherer.new{ x.d = ditherer.new{
c=1, c=1,
di = 0.34, di = 0.34,
} }
-- TODO: fade in level music
-- Switch to small font
-- (Dogica is too large to ever miss!)
font_compact()
end) end)
function arcade_level:activate()
-- TODO: fade in level music
font_compact()
end
function arcade_level:update() function arcade_level:update()
if self.phin.entered then if self.phin.entered then
if self.wordtimer <= 0 and self.wordremain > 0 then if self.wordtimer <= 0 and self.wordremain > 0 then
@ -1465,9 +1492,6 @@ function arcade_level:update()
if (self.d:update()) seq:next() if (self.d:update()) seq:next()
end end
self.v:update() self.v:update()
-- TODO: timers, word loop,
-- level state tracking and
-- progression, etc.
end end
function arcade_level:spawn_word() function arcade_level:spawn_word()
@ -1629,11 +1653,11 @@ function sequencer:next()
else else
mainview = rec.f() mainview = rec.f()
end end
if(mainview.activate) mainview:activate() mainview:activate()
mainview:update() mainview:update()
end end
function start_game() function create_game()
seq = sequencer.new{ seq = sequencer.new{
{ {
f=zonk_mode.new, f=zonk_mode.new,
@ -1682,7 +1706,6 @@ THIS ALL YOUR LIFE.]],
}}, }},
}, },
} }
seq:next()
end end
__gfx__ __gfx__