|
@@ -131,54 +131,54 @@ local starcolors = { 1, 2, 13, 15}
|
|
-- numparticles = number of particles to show
|
|
-- numparticles = number of particles to show
|
|
-- particletype = rain|snow|stars
|
|
-- particletype = rain|snow|stars
|
|
function particleinit(numparticles, type)
|
|
function particleinit(numparticles, type)
|
|
- -- initialize
|
|
|
|
- particles = {}
|
|
|
|
- particletype = type
|
|
|
|
- for i = 0, numparticles do
|
|
|
|
- table.insert(particles, {
|
|
|
|
- x = math.random() * 240,
|
|
|
|
- y = math.random() * 136,
|
|
|
|
- lastx = 0,
|
|
|
|
- lasty = 0,
|
|
|
|
- color = 2,
|
|
|
|
- t = 0,
|
|
|
|
- vel = 0,
|
|
|
|
- })
|
|
|
|
- end
|
|
|
|
|
|
+ -- initialize
|
|
|
|
+ particles = {}
|
|
|
|
+ particletype = type
|
|
|
|
+ for i = 0, numparticles do
|
|
|
|
+ table.insert(particles, {
|
|
|
|
+ x = math.random() * 240,
|
|
|
|
+ y = math.random() * 136,
|
|
|
|
+ lastx = 0,
|
|
|
|
+ lasty = 0,
|
|
|
|
+ color = 2,
|
|
|
|
+ t = 0,
|
|
|
|
+ vel = 0,
|
|
|
|
+ })
|
|
|
|
+ end
|
|
if particletype == 'stars' then
|
|
if particletype == 'stars' then
|
|
for i = 1, #particles do
|
|
for i = 1, #particles do
|
|
particles[i].twinkle = math.random() > 0.49 -- randomly pick true/false
|
|
particles[i].twinkle = math.random() > 0.49 -- randomly pick true/false
|
|
particles[i].color = starcolors[math.random(#starcolors)]
|
|
particles[i].color = starcolors[math.random(#starcolors)]
|
|
end
|
|
end
|
|
end
|
|
end
|
|
- if particletype == 'rain' then
|
|
|
|
|
|
+ if particletype == 'rain' then
|
|
for i = 1, #particles do
|
|
for i = 1, #particles do
|
|
- particles[i].vel = math.random(3) + 1
|
|
|
|
- if particles[i].vel > 2.5 then
|
|
|
|
- particles[i].color = 8
|
|
|
|
- end
|
|
|
|
- end
|
|
|
|
- end
|
|
|
|
- if particletype == 'snow' then
|
|
|
|
|
|
+ particles[i].vel = math.random(3) + 1
|
|
|
|
+ if particles[i].vel > 2.5 then
|
|
|
|
+ particles[i].color = 8
|
|
|
|
+ end
|
|
|
|
+ end
|
|
|
|
+ end
|
|
|
|
+ if particletype == 'snow' then
|
|
for i = 1, #particles do
|
|
for i = 1, #particles do
|
|
- particles[i].color = 15
|
|
|
|
- particles[i].vel = math.random() + 0.2
|
|
|
|
- end
|
|
|
|
- end
|
|
|
|
|
|
+ particles[i].color = 15
|
|
|
|
+ particles[i].vel = math.random() + 0.2
|
|
|
|
+ end
|
|
|
|
+ end
|
|
end
|
|
end
|
|
|
|
|
|
function particleupdate()
|
|
function particleupdate()
|
|
- if particletype == 'stars' then
|
|
|
|
- for i = 1,#particles do
|
|
|
|
- local p = particles[i]
|
|
|
|
- if not p.twinkle then goto continueTwinkle end
|
|
|
|
- ::continueTwinkle::
|
|
|
|
- if t % 15 == 0 and math.random() > 0.1 then
|
|
|
|
- p.color = starcolors[math.random(#starcolors)]
|
|
|
|
- end
|
|
|
|
- end
|
|
|
|
- end
|
|
|
|
- if particletype == 'rain' then
|
|
|
|
|
|
+ if particletype == 'stars' then
|
|
|
|
+ for i = 1,#particles do
|
|
|
|
+ local p = particles[i]
|
|
|
|
+ if not p.twinkle then goto continueTwinkle end
|
|
|
|
+ ::continueTwinkle::
|
|
|
|
+ if t % 15 == 0 and math.random() > 0.1 then
|
|
|
|
+ p.color = starcolors[math.random(#starcolors)]
|
|
|
|
+ end
|
|
|
|
+ end
|
|
|
|
+ end
|
|
|
|
+ if particletype == 'rain' then
|
|
for i = 1,#particles do
|
|
for i = 1,#particles do
|
|
local p = particles[i]
|
|
local p = particles[i]
|
|
if p.lasty and p.lasty > 136 then
|
|
if p.lasty and p.lasty > 136 then
|
|
@@ -187,12 +187,12 @@ function particleupdate()
|
|
p.x = math.random() * 240
|
|
p.x = math.random() * 240
|
|
end
|
|
end
|
|
p.lasty = p.y
|
|
p.lasty = p.y
|
|
- p.lastx = p.x
|
|
|
|
- p.x = p.x - p.vel / 5
|
|
|
|
|
|
+ p.lastx = p.x
|
|
|
|
+ p.x = p.x - p.vel / 5
|
|
p.y = p.y + p.vel * 1.5
|
|
p.y = p.y + p.vel * 1.5
|
|
end
|
|
end
|
|
- end
|
|
|
|
- if particletype == 'snow' then
|
|
|
|
|
|
+ end
|
|
|
|
+ if particletype == 'snow' then
|
|
for i = 1,#particles do
|
|
for i = 1,#particles do
|
|
local p = particles[i]
|
|
local p = particles[i]
|
|
if p.y and p.y > 136 then
|
|
if p.y and p.y > 136 then
|
|
@@ -200,10 +200,10 @@ function particleupdate()
|
|
p.lasty = 0
|
|
p.lasty = 0
|
|
p.x = math.random() * 240
|
|
p.x = math.random() * 240
|
|
end
|
|
end
|
|
- p.x = p.x - (math.random() - 0.4)
|
|
|
|
- p.y = p.y + p.vel
|
|
|
|
- end
|
|
|
|
- end
|
|
|
|
|
|
+ p.x = p.x - (math.random() - 0.4)
|
|
|
|
+ p.y = p.y + p.vel
|
|
|
|
+ end
|
|
|
|
+ end
|
|
end
|
|
end
|
|
|
|
|
|
function particledraw()
|
|
function particledraw()
|
|
@@ -214,10 +214,10 @@ function particledraw()
|
|
end
|
|
end
|
|
return
|
|
return
|
|
end
|
|
end
|
|
- for i = 1,#particles do
|
|
|
|
- local p = particles[i]
|
|
|
|
- pix(p.x, p.y, p.color)
|
|
|
|
- end
|
|
|
|
|
|
+ for i = 1,#particles do
|
|
|
|
+ local p = particles[i]
|
|
|
|
+ pix(p.x, p.y, p.color)
|
|
|
|
+ end
|
|
end
|
|
end
|
|
|
|
|
|
-- init here for title screen
|
|
-- init here for title screen
|
|
@@ -254,8 +254,8 @@ end
|
|
|
|
|
|
--LEVEL PROPERTIES (ANIMX/Y LIMITS(1-28,1-14))
|
|
--LEVEL PROPERTIES (ANIMX/Y LIMITS(1-28,1-14))
|
|
function level(m)
|
|
function level(m)
|
|
- -- reset level data
|
|
|
|
- sync (0,0, false)
|
|
|
|
|
|
+ -- reset level data
|
|
|
|
+ sync (0,0, false)
|
|
|
|
|
|
c=0
|
|
c=0
|
|
f=0
|
|
f=0
|
|
@@ -266,13 +266,13 @@ function level(m)
|
|
et=-255
|
|
et=-255
|
|
strig=0
|
|
strig=0
|
|
ftrig=0
|
|
ftrig=0
|
|
- t=0
|
|
|
|
|
|
+ t=0
|
|
|
|
|
|
- if m <= 2 then
|
|
|
|
- particleinit(150, 'stars')
|
|
|
|
- else
|
|
|
|
- particleinit(120, 'rain')
|
|
|
|
- end
|
|
|
|
|
|
+ -- switch particles
|
|
|
|
+ if m==1 then particleinit(150, 'stars') end
|
|
|
|
+ if m>=2 and m<12 then particleinit(120, 'rain') end
|
|
|
|
+ if m>=12 then particleinit(180, 'snow') end
|
|
|
|
+ if m==22 then particleinit(150, 'stars') end
|
|
|
|
|
|
if m > 0 then
|
|
if m > 0 then
|
|
local data = leveldata[m]
|
|
local data = leveldata[m]
|
|
@@ -373,8 +373,11 @@ function TIC()
|
|
fade_in(0)
|
|
fade_in(0)
|
|
--REMAP
|
|
--REMAP
|
|
cls()
|
|
cls()
|
|
- particleupdate()
|
|
|
|
|
|
+ if ptrig==0 then
|
|
|
|
+ particleupdate()
|
|
|
|
+ end
|
|
particledraw()
|
|
particledraw()
|
|
|
|
+ rect(0,0,240,8,0)
|
|
map(30*m%240,17*(m//8),30,17,0,0,0,1,
|
|
map(30*m%240,17*(m//8),30,17,0,0,0,1,
|
|
function(tile)
|
|
function(tile)
|
|
if tile>=80 and tile<=111 and anix==0 and aniy==0 and px==0 and aepx==0 then
|
|
if tile>=80 and tile<=111 and anix==0 and aniy==0 and px==0 and aepx==0 then
|