diff --git a/vacation.p8 b/vacation.p8 index 26c4421..4f603a9 100644 --- a/vacation.p8 +++ b/vacation.p8 @@ -1783,6 +1783,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 +1954,7 @@ THIS ALL YOUR LIFE.]], }}, }, {f=normal_awakener}, + {f=ggwp}, } end