Files
pico8/lou.p8
2025-07-26 20:32:46 +02:00

162 lines
4.7 KiB
Lua

pico-8 cartridge // http://www.pico-8.com
version 42
__lua__
--main
function _init()
cartdata("lou")
lou:init()
end
function _update()
lou.age+=sincelast()
savedate()
state[cs]:update()
bgm:loop()
fc+=1
end
function _draw()
cls()
end
-->8
--globals
gameover=false
cs=1 --current state
fc=0 --frame counter
-->8
--functions
function savedate()
dset(0,stat(90))--year
dset(1,stat(91))--month
dset(2,stat(92))--day
dset(3,stat(93))--hour
dset(4,stat(94))--minute
dset(5,stat(95))--second
end
function sincelast()
y=(stat(90)-dget(0))
if y>0 then
gameover=true
end
y=0
mo=(stat(91)-dget(1))*25.920 --30 days in a month
d=(stat(92)-dget(2))*864
h=(stat(93)-dget(3))*36
m=(stat(94)-dget(4))*.6
s=(stat(95)-dget(5))*.01
return s+m+h+d+mo+y
end
-->8
--state
state={
{ --1 gameplay
m={0,1},--music
ml=128,--music length
cm=0,
update=function(self)
end,
draw=function(self)
end,
},
{}
}
-->8
--lou
lou={
new=1,
age=0,
init=function(self)
self.new=dget(10)
if self.new == 0 then --new lou
self.new=1
self.age=0
--overwrite date for first time
savedate()
self:save()
else
self.age=dget(11)
self:save()
end
end,
save=function(self)
dset(0,self.new)
dset(1,self.age)
end
}
-->8
--bgm
bgm={
tracklist={
{
n=2,
l=254
},
{
n=0,
l=127
},
{
n=1,
l=127
}
},
l=254,
c=1,
t=-1,
loop=function(self)
if (self.t>self.tracklist[self.c].l) self.t=0
if self.t==0 then
self.c+=1
printh("playing: "..self.c)
if self.c>count(self.tracklist) then
self.c=1
printh("ok")
end
music(self.tracklist[self.c].n)
end
self.t+=1
end
}
__gfx__
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00077000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
00700700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
__sfx__
000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
011000000e0200e0200e0200e0200e0200e0200e0200e0200e0200e0200e0200e0200e0200e0200e0200e0200b0200b0200b0200b0200b0200b0200b0200b0200b0200b0200b0200b0200b0200b0200b0200b020
011000001e150000001e000000001e150000001e000000001e150000001e000000001e150000001e000000001e150000001e000000001e150000001e000000001e150000001e000000001e150000001e00000000
01100000000000000000000000001a1500000000000000001a1500000000000000001a1500000000000000001a0000000000000000001a1500000000000000001a1500000000000000001a150000000000000000
001000000000015000151501500000000150001515000000000001500015150150000000015000151500000000000000001315000000000000000013150000000000000000131500000000000000001315000000
011000000c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c020
011000001c1500000000000000001c1500000000000000001c1500000000000000001c1500000000000000001c1500000000000000001c1500000000000000001c1500000000000000001c150000000000000000
01100000000000000013150000001a0000000013150000001a0000000013150000001a0000000013150000001a0000000013150000001a0000000013150000001a0000000013150000001a000000001315000000
01100000000001300013000000001a1501300013000000001a1500000013000000001a1500000013000000001a0000000013000000001a1500000013000000001a1500000013000000001a150000001300000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
002000000e0200e0200e0200e0200e0200e0200e0200e0200b0200b0200b0200b0200b0200b0200b0200b0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c0200c020
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0020000000000151501a150151501a150151501a1501515000000131501a150131501a150131501a1501315000000131501a150131501a150131501a150131501a150131501a150131501a150131501a15013150
002000001e150000001e150000001e150000001e150000001e150000001e150000001e150000001e150000001c150000001c150000001c150000001c150000001c150000001c150000001c150000001c15000000
__music__
00 01020304
00 05060708
00 0a440c0d
00 0a0c0d13