diff --git a/vacuum_gambit.p8 b/vacuum_gambit.p8 index da676a8..3ae9c1b 100644 --- a/vacuum_gambit.p8 +++ b/vacuum_gambit.p8 @@ -124,11 +124,12 @@ function linked_list:pop_front() end function _init() + mode = game_mode init_blip_pals() wipe_level() primary_ship.main_gun = zap_gun_p.new() -- redundant? load_level(example_level_csv) - state = game + game_state = game pal(2,129) pal() end @@ -172,7 +173,7 @@ function wipe_level() end function _update60() - updategame() + mode:update() end function call_f(x) @@ -249,9 +250,9 @@ function updategame() intangibles_fg:strip(call_move) if leveldone and not eships.next and not ebullets.next and not events.next then - state = win + game_state = win end - if (not pships.next) state = lose + if (not pships.next) game_state = lose if primary_ship.xp >= primary_ship.xptarget then if not xpwhoosh then @@ -266,14 +267,23 @@ function updategame() end function _draw() + mode:draw() +end + +function drawgame_top() fillp(0) drawgame() - if (state == game) fadelvl = -45 - if (state == win) dropshadow("win",50,61,11) - if (state == lose) dropshadow("fail",48,61,8) + if (game_state == game) fadelvl = -45 + if (game_state == win) dropshadow("win",50,61,11) + if (game_state == lose) dropshadow("fail",48,61,8) fadescreen() end +game_mode = { + update = updategame, + draw = drawgame_top, +} + fadetable = split"0,1.5,1025.5,1029.5,1285.5,1413.5,9605.5,9637.5,-23130.5,-23066.5,-18970.5,-18954.5,-2570.5,-2568.5,-520.5,-8.5,-0.5" function fadescreen()