Compare commits
2 Commits
2ed036efc0
...
0bf07e1558
Author | SHA1 | Date | |
---|---|---|---|
0bf07e1558 | |||
7be4792771 |
128
vacation.p8
128
vacation.p8
@ -40,19 +40,6 @@ function hz(n)
|
||||
return t()*2*n&1~=0
|
||||
end
|
||||
|
||||
-- generate standard "overlay"
|
||||
-- constructor for type tt.
|
||||
-- if more is defined, generated
|
||||
-- new calls more(ret) after
|
||||
-- ret is definitely not nil
|
||||
-- before calling setmetatable.
|
||||
-- use to initialize mutables.
|
||||
--
|
||||
-- if there was a previous new,
|
||||
-- it is invoked on the new
|
||||
-- object *after* more, because
|
||||
-- this works better with the
|
||||
-- `more` impls i use.
|
||||
function mknew(tt, more)
|
||||
local mt, oldnew={__index=tt},tt.new
|
||||
tt.new=function(ret)
|
||||
@ -178,20 +165,6 @@ function pukeboard(item)
|
||||
puketh(item, "@clip")
|
||||
end
|
||||
|
||||
-------------------------------
|
||||
-- view
|
||||
-------------------------------
|
||||
-- composits drawable items.
|
||||
-- add items to .views to
|
||||
-- composit them. x and y are
|
||||
-- relative reverse camera
|
||||
-- offsets. drawable items will
|
||||
-- observe appropriate incoming
|
||||
-- camera and clip state.
|
||||
-- clipping respects existing
|
||||
-- clipping so stacked views
|
||||
-- intersect.
|
||||
-------------------------------
|
||||
view = {
|
||||
x=0,
|
||||
y=0,
|
||||
@ -214,16 +187,10 @@ function view:draw()
|
||||
local oldcam, oldclip = $0x5f28, $0x5f20
|
||||
poke2(0x5f28, %0x5f28-self.x)
|
||||
poke2(0x5f2a, %0x5f2a-self.y)
|
||||
clip(-%0x5f28, -%0x5f2a, self.w, self.h, true)
|
||||
outer_or_each_opt(self.views, "draw")
|
||||
poke4(0x5f20, oldclip)
|
||||
poke4(0x5f28, oldcam)
|
||||
end
|
||||
|
||||
-- draws opaque rectangles.
|
||||
-- default bg is equivalent to
|
||||
-- clip-aware cls.
|
||||
-- restores prior fill pattern.
|
||||
bg = {
|
||||
x=0,y=0,w=128,h=128,fp=0,c=0
|
||||
}
|
||||
@ -322,7 +289,6 @@ end
|
||||
-->8
|
||||
-- text rendering
|
||||
|
||||
-- text colors for zonk mode:
|
||||
txtbox = {
|
||||
x=0,
|
||||
y=0,
|
||||
@ -1783,6 +1749,99 @@ function droplet:draw()
|
||||
pset(self.x+r2, self.y-r2, 0x100F)
|
||||
end
|
||||
|
||||
-->8
|
||||
-- end of game
|
||||
|
||||
ggwp = {
|
||||
frem = 60
|
||||
}
|
||||
mknew(ggwp, function(self) end)
|
||||
|
||||
function ggwp:activate()
|
||||
font_monogram()
|
||||
local score_pct = 100
|
||||
if seq.max_score ~= 0 then
|
||||
score_pct = seq.score*100\seq.max_score
|
||||
end
|
||||
if (score_pct == 0 and seq.score > 0) score_pct = 1
|
||||
self.score_pct = "\^w\^t"..tostr(score_pct).."%"
|
||||
self.score_str = tostr(seq.score).." / "..tostr(seq.max_score)
|
||||
self.col = irnd(8)+8
|
||||
|
||||
if score_pct == 100 then
|
||||
self.final_text=[[perfect! remarkable! you hit
|
||||
each and every target.
|
||||
good toy!]]
|
||||
elseif score_pct > 90 then
|
||||
self.final_text=[[ so close!
|
||||
going to go for them all
|
||||
next time?]]
|
||||
elseif score_pct > 20 then
|
||||
self.final_text=[[ hope you had fun!
|
||||
come play again some time!]]
|
||||
elseif score_pct > 5 then
|
||||
self.final_text=[[ wow! it is harder to miss the
|
||||
words than to hit them. this is
|
||||
a great try! think you can miss
|
||||
all of them next time?]]
|
||||
elseif score_pct > 0 then
|
||||
self.final_text=[[ you're so close! just a tiny
|
||||
bit more and you will miss every
|
||||
target! this is a phenomenal
|
||||
accomplishment already. will you
|
||||
miss them all next time?]]
|
||||
else
|
||||
self.final_text=[[unbelieveable! i didn't think
|
||||
this was even possible!
|
||||
spectacular work.
|
||||
good toy!!]]
|
||||
end
|
||||
end
|
||||
|
||||
function ggwp:update()
|
||||
if (hz(2) ~= self.lasthz) self.col = irnd(8)+8
|
||||
self.lasthz = hz(2)
|
||||
if (self.frem <= 0 and btnp(1) and not self.d) self.d = ditherer.new{di=0.5}
|
||||
if (self.frem > 0) self.frem -= 1
|
||||
if (self.d and self.d:update()) seq:next()
|
||||
end
|
||||
|
||||
sunset_pal=split"12,13,14,8,137,9,10,129,1,130,2,140,5,6,7"
|
||||
|
||||
function ggwp:draw()
|
||||
pal()
|
||||
clear_alt_pal_bits()
|
||||
pal(sunset_pal,1)
|
||||
for i=0,5 do
|
||||
local col, y0 = 0x1000 + i+1 + (i+2 << 4),20*i
|
||||
for j,p in ipairs{0, 0x5050>>>16,0x5a5a>>>16, 0xafaf>>>16} do
|
||||
rectfill(0, y0 + 5*j, 128, y0+4+5*j,col+p)
|
||||
end
|
||||
end
|
||||
rectfill(0, 120, 128, 128, 0x1007)
|
||||
font_special()
|
||||
print("\^w\^tgreat job!",5,4,0)
|
||||
print("fINAL SCORE:", 5, 26, 0)
|
||||
--0, 8, 9, 12
|
||||
local xpos = 123-6*#self.score_str
|
||||
print(self.score_str, xpos+3, 35, 15)
|
||||
print(self.score_str, xpos+2, 34, 14)
|
||||
print(self.score_str, xpos+1, 33, 12)
|
||||
print(self.score_str, xpos, 32, 0)
|
||||
|
||||
print(self.score_pct,64-3*#self.score_pct,55,self.col)
|
||||
|
||||
font_default()
|
||||
local xoff = print(self.final_text, 0, -999, 0) - 1
|
||||
print(self.final_text, 64-xoff/2, 90, 0)
|
||||
|
||||
if self.frem <= 0 and not self.d then
|
||||
print("➡️", 117, 120, 12)
|
||||
print("➡️", 116, 119, hz(2) and 0 or 13)
|
||||
end
|
||||
if (self.d) self.d:draw()
|
||||
end
|
||||
|
||||
-->8
|
||||
-- game sequencer
|
||||
|
||||
@ -1861,6 +1920,7 @@ THIS ALL YOUR LIFE.]],
|
||||
}},
|
||||
},
|
||||
{f=normal_awakener},
|
||||
{f=ggwp},
|
||||
}
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user