|
@@ -8,14 +8,16 @@ x=96
|
|
y=24
|
|
y=24
|
|
|
|
|
|
particles = {}
|
|
particles = {}
|
|
-particletype = 'stars'
|
|
|
|
-local starcolors = { 1, 2, 13, 15}
|
|
|
|
|
|
+local starcolors = { 8, 9, 10, 11, 12 }
|
|
|
|
+local snowcolors = { 12, 13 }
|
|
|
|
+local raincolors = { 8, 9 } -- in order of depth, farthest to closest
|
|
|
|
+-- rain|snow|stars
|
|
|
|
+particletype = 'snow'
|
|
|
|
+
|
|
-- numparticles = number of particles to show
|
|
-- numparticles = number of particles to show
|
|
--- particletype = rain|snow|stars
|
|
|
|
-function particleinit(numparticles, type)
|
|
|
|
|
|
+function particleinit(numparticles)
|
|
-- initialize
|
|
-- initialize
|
|
particles = {}
|
|
particles = {}
|
|
- particletype = type
|
|
|
|
for i = 0, numparticles do
|
|
for i = 0, numparticles do
|
|
table.insert(particles, {
|
|
table.insert(particles, {
|
|
x = math.random() * 240,
|
|
x = math.random() * 240,
|
|
@@ -35,16 +37,20 @@ function particleinit(numparticles, type)
|
|
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
|
|
|
|
|
|
+ particles[i].vel = math.random(4) + 1
|
|
|
|
+ particles[i].color = raincolors[1]
|
|
|
|
+ if particles[i].vel > 3.1 then
|
|
|
|
+ particles[i].color = raincolors[2]
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
if particletype == 'snow' then
|
|
if particletype == 'snow' then
|
|
for i = 1, #particles do
|
|
for i = 1, #particles do
|
|
- particles[i].color = 15
|
|
|
|
|
|
+ particles[i].color = snowcolors[1]
|
|
particles[i].vel = math.random() + 0.2
|
|
particles[i].vel = math.random() + 0.2
|
|
|
|
+ if particles[i].vel > 0.8 then
|
|
|
|
+ particles[i].color = snowcolors[2]
|
|
|
|
+ end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
@@ -54,10 +60,10 @@ function particleupdate()
|
|
for i = 1,#particles do
|
|
for i = 1,#particles do
|
|
local p = particles[i]
|
|
local p = particles[i]
|
|
if not p.twinkle then goto continueTwinkle end
|
|
if not p.twinkle then goto continueTwinkle end
|
|
- ::continueTwinkle::
|
|
|
|
if t % 15 == 0 and math.random() > 0.1 then
|
|
if t % 15 == 0 and math.random() > 0.1 then
|
|
p.color = starcolors[math.random(#starcolors)]
|
|
p.color = starcolors[math.random(#starcolors)]
|
|
end
|
|
end
|
|
|
|
+ ::continueTwinkle::
|
|
end
|
|
end
|
|
end
|
|
end
|
|
if particletype == 'rain' then
|
|
if particletype == 'rain' then
|
|
@@ -66,7 +72,7 @@ function particleupdate()
|
|
if p.lasty and p.lasty > 136 then
|
|
if p.lasty and p.lasty > 136 then
|
|
p.y = 0
|
|
p.y = 0
|
|
p.lasty = 0
|
|
p.lasty = 0
|
|
- p.x = math.random() * 240
|
|
|
|
|
|
+ p.x = math.random() * 260 - 10
|
|
end
|
|
end
|
|
p.lasty = p.y
|
|
p.lasty = p.y
|
|
p.lastx = p.x
|
|
p.lastx = p.x
|
|
@@ -80,7 +86,7 @@ function particleupdate()
|
|
if p.y and p.y > 136 then
|
|
if p.y and p.y > 136 then
|
|
p.y = 0
|
|
p.y = 0
|
|
p.lasty = 0
|
|
p.lasty = 0
|
|
- p.x = math.random() * 240
|
|
|
|
|
|
+ p.x = math.random() * 260 - 10
|
|
end
|
|
end
|
|
p.x = p.x - (math.random() - 0.4)
|
|
p.x = p.x - (math.random() - 0.4)
|
|
p.y = p.y + p.vel
|
|
p.y = p.y + p.vel
|
|
@@ -103,7 +109,7 @@ function particledraw()
|
|
end
|
|
end
|
|
|
|
|
|
-- init here for title screen
|
|
-- init here for title screen
|
|
-particleinit(150, 'snow')
|
|
|
|
|
|
+particleinit(150)
|
|
|
|
|
|
|
|
|
|
function TIC()
|
|
function TIC()
|
|
@@ -113,12 +119,12 @@ function TIC()
|
|
if btn(2) then x=x-1 end
|
|
if btn(2) then x=x-1 end
|
|
if btn(3) then x=x+1 end
|
|
if btn(3) then x=x+1 end
|
|
|
|
|
|
- cls(13)
|
|
|
|
- spr(1+t%60//30*2,x,y,14,3,0,0,2,2)
|
|
|
|
- print("HELLO WORLD!",84,84)
|
|
|
|
-
|
|
|
|
|
|
+ cls(0)
|
|
particleupdate()
|
|
particleupdate()
|
|
particledraw()
|
|
particledraw()
|
|
|
|
+
|
|
|
|
+ spr(1+t%60//30*2,x,y,14,3,0,0,2,2)
|
|
|
|
+ print("HELLO WORLD!",84,84)
|
|
|
|
|
|
t=t+1
|
|
t=t+1
|
|
end
|
|
end
|