diff --git a/vacation.p8 b/vacation.p8 index de77185..6d51b4d 100644 --- a/vacation.p8 +++ b/vacation.p8 @@ -59,6 +59,12 @@ function event_list:pb(x) self.tail = x end +function event_list:pf(x) + if (not self.next) self.tail = x + x.next = self.next + self.next = x +end + function event_list:u() local p, n = self, self.next while n do @@ -1595,9 +1601,35 @@ end) function arcade_level:av() if (musicmode & 1 ==0) music(0,1000,7) + for _=1,5 do + self:gen_fish(0, 150) + end font_compact() end +function arcade_level:gen_fish(xmin, xrg) + local fishdx = rnd(0.5) - 0.25, rnd(xrg) + xmin + local fish = spritem.new{ + x = rnd(xrg) + xmin, + y = 80 + irnd(44), + s = {54, 55, 56, 55}, + flipx = fishdx < 0, + i = irnd(4) + 1, + f = 20, + } + bg.pf(parallax.new{ + level=self, + item=fish, + dx=fishdx, + z=0.5 + rnd(0.4), + id="fish", + }) +end + +function arcade_level:pdone(item) + if (item.id == "fish") self:gen_fish(129, 200) +end + function arcade_level:onmchg() music((musicmode & 0x1 == 0) and 0 or -1, 500, 7) end @@ -1621,6 +1653,7 @@ function arcade_level:u() end if (self.d:u()) seq:next() end + self.pdx = (self.phin.entered and not self.phin.exiting) and -1 or 0 self.v:u() end