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