rework splashing
This commit is contained in:
parent
ca7517cc3a
commit
8604cf2308
16
vacation.p8
16
vacation.p8
@ -619,7 +619,7 @@ mknew(sea)
|
|||||||
|
|
||||||
function sea:draw()
|
function sea:draw()
|
||||||
local w = wave()
|
local w = wave()
|
||||||
rectfill(0, 64+w, 128, 80+w, 0)
|
rectfill(0, 72+w, 128, 80+w, 0)
|
||||||
poke2(0x5f78, 0xFF00.00FF <<> w)
|
poke2(0x5f78, 0xFF00.00FF <<> w)
|
||||||
rectfill(0, 81+w, 128, 89+w, 0x1040.a842)
|
rectfill(0, 81+w, 128, 89+w, 0x1040.a842)
|
||||||
rectfill(0, 90+w, 128, 97+(w>>1), 0x1004.e169)
|
rectfill(0, 90+w, 128, 97+(w>>1), 0x1004.e169)
|
||||||
@ -676,7 +676,7 @@ function arcade_level:draw_splash(x, force)
|
|||||||
local n = (force + rnd(force)) & 0x7FF
|
local n = (force + rnd(force)) & 0x7FF
|
||||||
for i=0,n do
|
for i=0,n do
|
||||||
local d = droplet.new{x=x, force=force, y=72+wave(), f=i/n-0.5}
|
local d = droplet.new{x=x, force=force, y=72+wave(), f=i/n-0.5}
|
||||||
if d.dr < 0 then
|
if rnd() < 0.5 then
|
||||||
self.bg:push_back(d)
|
self.bg:push_back(d)
|
||||||
else
|
else
|
||||||
self.fg:push_back(d)
|
self.fg:push_back(d)
|
||||||
@ -704,27 +704,25 @@ function arcade_level:landing_splash(x, force, harder)
|
|||||||
self:draw_splash(x, force)
|
self:draw_splash(x, force)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
splashcols = {0x1003, 0x103d.a5a5}
|
||||||
droplet = {}
|
droplet = {}
|
||||||
mknew(droplet, function(d)
|
mknew(droplet, function(d)
|
||||||
d.dx = d.f * d.force >> 2
|
d.dx = d.f * d.force >> 2
|
||||||
d.x += 16 * d.f
|
d.x += 16 * d.f
|
||||||
d.dy = -rnd(d.force>>1)
|
d.dy = -rnd(d.force*0.66)
|
||||||
d.r = rnd(1) + 1
|
d.r = 1 + rnd(0.75 + (d.force >> 4))
|
||||||
d.dr = rnd(0.025) - 0.0125
|
|
||||||
d.ymo = 255 * d.dr
|
|
||||||
d.c = rnd(splashcols)
|
d.c = rnd(splashcols)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
function droplet:update()
|
function droplet:update()
|
||||||
self.x += self.dx
|
self.x += self.dx
|
||||||
self.y += self.dy
|
self.y += self.dy
|
||||||
self.r += self.dr
|
|
||||||
self.dy += 0.3
|
self.dy += 0.3
|
||||||
return self.y > self.ymo + 72 + wave() or self.r < 0.5
|
return self.y >72 + wave()
|
||||||
end
|
end
|
||||||
|
|
||||||
function droplet:draw()
|
function droplet:draw()
|
||||||
circfill(self.x, self.y, self.r, 0x1003)
|
circfill(self.x, self.y, self.r, self.c)
|
||||||
local r2 = self.r >> 1
|
local r2 = self.r >> 1
|
||||||
pset(self.x+r2, self.y-r2, 0x100F)
|
pset(self.x+r2, self.y-r2, 0x100F)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user