Final win screen!

This commit is contained in:
Pyrex 2024-02-11 17:58:34 -08:00
parent 4a61d8afd3
commit 6949abc2fb
6 changed files with 66 additions and 10 deletions

View File

@ -11,6 +11,22 @@ function completion_tracker:reset()
end
end
function completion_tracker:get_metascore()
local b0=dget"60"
local b1=dget"61"
local b2=dget"62"
local b3=dget"63"
return (b0<<8)+b1+(b2>>8)+(b3>>16)
end
function completion_tracker:incr_metascore()
local ms=self:get_metascore()
ms+=0x0.0001
dset(60,(ms>>8)&0xff)
dset(61,(ms)&0xff)
dset(62,(ms<<8)&0xff)
dset(63,(ms<<16)&0xff)
end
function completion_tracker:get_completion_level()
return dget(0)
end

17
main.p8
View File

@ -27,6 +27,7 @@ __lua__
#include state_ironman.lua
#include state_reset_menu.lua
#include state_restartmenu.lua
#include state_wonironman.lua
#include state_wonround.lua
#include tutorial.lua
#include text.lua
@ -72,14 +73,14 @@ __gfx__
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
fffffffff000000000000000000000000000000000000ff000000000000000000000000000000000000000000000000000000000000000000000000000000000
0ff0000fff00000000000000000000000000000000000ff00000000000fff0000000000000000000000000000000000000000000000000000000000000000000
0ff00000ff000ffff00ffff00fff00ffff000ff0fff00f00fffff000000fff000000000000000000000000000000000000000000000000000000000000000000
0ff0000ff000f000ff00ff0000f00f000ff0ffff00ff000ff000f00000fff0000000000000000000000000000000000000000000000000000000000770000000
0ff0fff000000000ff00ff0000f0ff000ff00ff000ff000ff0000000000000000000000000000000000000000000000000000000000000000000777700000000
0ff00ff000000fffff000ff00f00fffffff00ff000ff000ffff00000000000000000000000000000000000000000000000000000000000000777777700000000
0ff000ff0000f000ff000ff00f00ff0000000ff000ff00000ffff000000000000000000000000000000000000000000000000000000000007777777700000000
0ff0000ff00ff000ff0000f0f000ff0000000ff000ff0000000ff000000000000000000000000000000000000000000000000000000000777777777000000000
fffffffff000000000000000000000000000000000000ff00000000000000000000000a000000000000000000000000000000000000000000000000000000000
0ff0000fff00000000000000000000000000000000000ff00000000000fff000900009aa0000a000000000000000000000000000000000000000000000000000
0ff00000ff000ffff00ffff00fff00ffff000ff0fff00f00fffff000000fff00999009aa00aaa000000000000000000000000000000000000000000000000000
0ff0000ff000f000ff00ff0000f00f000ff0ffff00ff000ff000f00000fff000099999aaaaaa0000000000000000000000000000000000000000000770000000
0ff0fff000000000ff00ff0000f0ff000ff00ff000ff000ff000000000000000099999aaaaaa0000000000000000000000000000000000000000777700000000
0ff00ff000000fffff000ff00f00fffffff00ff000ff000ffff0000000000000099999aaaaaa0000000000000000000000000000000000000777777700000000
0ff000ff0000f000ff000ff00f00ff0000000ff000ff00000ffff00000000000009999aaaaa00000000000000000000000000000000000007777777700000000
0ff0000ff00ff000ff0000f0f000ff0000000ff000ff0000000ff00000000000009999aaaaa00000000000000000000000000000000000777777777000000000
0ff00000ff0ff00fff0000fff0000ff000f00ff000ff000f000ff000000000000000000000000000000000000000000000000000000007777777700000000000
ffff0000fff0fff0fff0000f000000ffff00ffff00fff00fffff0000000000000000000000000000000000000000000000000000000077777777000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000777777770000000000000

View File

@ -28,6 +28,7 @@ function state_ironman:on_enter()
local w=self.sequence[level]()
main.state_manager:push(state_gameround:new(w))
else
main.state_manager:push(state_wonironman:new())
self.done=true
end
end

View File

@ -54,6 +54,7 @@ function state_menu:draw()
local totalh=optionsh+32
local y=128-totalh-1--64-totalh\2
-- rectfill(68,y,126,y+totalh-1,13)
local y0=y
spr(64,68,y,7,3)
y+=22
line(68,y,126,y,15)
@ -82,6 +83,13 @@ function state_menu:draw()
y+=2
end
end
-- metascore
local metascore=completion_tracker:get_metascore()
if metascore>0 then
spr(72,66,y0-9,2,1)
print("="..tostr(metascore,2),79,y0-6,6)
end
end
function state_menu:draw_bg()

30
state_wonironman.lua Normal file
View File

@ -0,0 +1,30 @@
state_wonironman=klass()
function state_wonironman:init()
end
function state_wonironman:enter()
completion_tracker:incr_metascore()
end
function state_wonironman:exit(new_top) end
function state_wonironman:reenter() end
function state_wonironman:suspend() end
function state_wonironman:update()
if (btnp(4)) self.done=true
end
function state_wonironman:draw()
cls(13)
local msg="you have reached the bottom\n\nreceive one majestic kroner"
local w,h=measure_text(msg)
local x=64-w\2
local y=64-h\2
line(64-7,y-3,64+7,y-3,15)
line(64-7,y+h+1,64+7,y+h+1,15)
rectfill(x-1,y-1,x+w,y+h-1,4)
print(msg,x,y,15)
y+=h+3
spr(72,64-6,y,2,1)
line(64-7,y+9,64+7,y+9,15)
print("next",57,y+11,15)
print("(🅾️)",57,y+17,15)
end

View File

@ -59,6 +59,6 @@ function state_wonround:draw()
]]--
y+=h+1
line(oldx,y,oldx+oldw-2,y,15)
print("next",56,y+2,15)
print("(🅾️)",56,y+8,15)
print("next",57,y+2,15)
print("(🅾️)",57,y+8,15)
end