Compare commits

...

2 Commits

Author SHA1 Message Date
7b931d1fba
Save/load system. Not golfed.
Saves the music flag, the last level the player played, and the furthest level reached. Loads music flag on launch. Title screen starts on most recent level played; when in "release configuration" the title screen will only let the player pick levels up to the maximum reached through gameplay, but right now this is replaced with the 31.

Save file can be wiped by holding the down arrow at the title screen.
2023-01-02 13:43:26 -08:00
7c209f1125 Level 23. Minimal "requires pivot to avoid occlusion". (#22)
Fix spurious pit.

Reviewed-on: pyrex/chameleonic#22
Co-authored-by: Kistaro Windrider <kistaro@gmail.com>
Co-committed-by: Kistaro Windrider <kistaro@gmail.com>
2023-01-02 21:31:20 +00:00

View File

@ -8,8 +8,9 @@ real_modules={}
frame=0
function _init()
-- printh("restarting")
music_on()
_doall("init") end
_doall("init")
end
function _update()
frame+=1
if (frame%1==0) _doall("update") end
@ -17,12 +18,16 @@ function _draw()
_doall("draw") end
function music_on()
music(0)
if (stat(54) ~= 0) music(0)
persist.music=true
persist:write()
menuitem(3, "music: on", music_off)
end
function music_off()
music(-1)
persist.music=false
persist:write()
menuitem(3, "music: off", music_on)
end
@ -261,7 +266,7 @@ end
title={}
add(modules,title)
blinkcol=10
lvlshimmer = {4,9,10,10,9}
function title:draw()
cls(0)
-- this is right for 72x32
@ -270,22 +275,33 @@ function title:draw()
print("[nyeogmi]",62,73,7)
print("kistaro",32,79,7)
local lvlstr = "⬅️ "..start_level.." ➡️"
print(lvlstr,50,91,1)
print(lvlstr,51,90,blinkcol)
local lx, ly = 51+wrongbleep:vibrate(), 90+wrongbleep:vibrate()
print(lvlstr,lx-1,ly+1,1)
print(lvlstr,lx,ly,cycle(lvlshimmer))
end
start_level=0
max_level=31
function title:init()
start_level=persist.recent_level
-- max_level=persist.max_level
max_level = 31 --debugging/coding
wiped = false
end
function title:update()
blinkcol=9
if (time()*4\1%2==0) blinkcol=10
if (btnp"0") start_level-=1
if (btnp"1") start_level+=1
start_level%=max_level
if (btnp"4" or btnp"5") modules=real_modules _init() music(0)
start_level%=(max_level+1)
if btn"3" and not wiped then
wrongbleep:bleep()
if (wrongbleep:adequately_warned()) then
persist:wipe()
max_level = 0
start_level = 0
wiped=true
-- todo: sfx(kaboom!)
end
end
if (btnp"4" or btnp"5") modules=real_modules _init()
end
-->8
@ -308,6 +324,8 @@ function level:reinit(n)
self:load_dynobjs()
self:recollide_reanchor()
self:spawn_exit()
persist:lvlstart()
end
function level:restart()
@ -1715,6 +1733,7 @@ end
-->8
--wrongbleeps
wrongbleep={}
add(modules,wrongbleep)
add(real_modules,wrongbleep)
function wrongbleep:init()
self.duration=0
@ -1722,8 +1741,12 @@ function wrongbleep:init()
end
function wrongbleep:update()
if (self.duration>5) self.duration=5
if self.duration>0 then sfx(63,3) self.continuous+=1
else self.continuous=0 end
if self.duration>0 then
sfx(63,3)
self.continuous+=1
else
self.continuous=0
end
self.duration=max(self.duration-1,-4)
end
function wrongbleep:bleep(duration)
@ -1881,6 +1904,49 @@ function debugmouse:draw3()
pal()
end
-->8
-- save/load
persist={}
add(modules, persist)
add(real_modules, persist)
function persist:init0()
cartdata("ulimate_lizard_total_destruction_0_1")
self.init0 = self.read
self:read()
self.ready=true
end
function persist:read()
local m = dget(0) == 0
self.music = m
if m then music_on() else music_off() end
self.max_level = dget(1)
self.recent_level = dget(2)
end
function persist:wipe()
self.ready=false
for i=0,64 do
dset(i,0)
end
self:read()
self.ready=true
end
function persist:lvlstart()
self.recent_level = level.ix
self.max_level = max(self.max_level, level.ix)
self:write()
end
function persist:write()
if (not self.ready) return
dset(0, self.music and 0 or -1)
dset(1, self.max_level)
dset(2, self.recent_level)
end
__gfx__
000030000000002200003000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeff1ff1ff1fffffff1ffffff1fffffff1dddddddd111111110000000033300333
003333300000332200333330eeffffffffffffffffffffeee5e555e55e555e5eff1ff1ffffffffffffffffffffffffffdddddddd111111110cc00cc033300333
@ -1947,37 +2013,37 @@ eeee0000cc04405500444400efeeee5e11111111e5eeeefeeeeeeeeeeeeeeeeeffffffffffffffff
00880888880880888880880000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000888888800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000030404040404040402140404040404050
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c0c0c0c0c0c000c0c0c0c0c0c051
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c0c0c0c0c0c000c0c0c0c0c0c051
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c0c0c0c0c0c000c0c0c0c0c0c051
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c0c0c0c0c0c000c0c0c0c0c0c051
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c0c0c0c0c0c000c0c0c0c0c0c051
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c0c0c0c0c0c000c0c0c0c0c0c051
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c000000000f300c0c0c0c0c0c051
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c00000e1e10000c0c0c0c0c0c051
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c00000000491b100c0c0c0c0c051
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c000040000000000c0c0c0c0c051
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c0000000c000c0c0c0c0c0c0c051
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c0c0c0c0c000c0c0c0c0c0c0c051
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c0c0c0c0c000c0c0c0c0c0c0c051
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000031c0c0c0c0c0c000c0c0c0c0c0c0c051
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000032424242424242104242424242424252
d0d0d0d0d0d0d0d0e3d0d0d0d0d0d0d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0
d0d0d0d0d0d04100000041d0d0d0d0d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000