Browse Source

fixing palette

pixelbath 3 years ago
parent
commit
e464e750e2
1 changed files with 41 additions and 26 deletions
  1. 41 26
      alter-ego-by-kyuchumimo.lua

+ 41 - 26
alter-ego-by-kyuchumimo.lua

@@ -94,7 +94,7 @@ map()
 
 --PALETTE STUFF
 local basepalette = {
-	0x1a1c2c, 0x29366f, 0x3b5dc9, 0x493c2b, 0x5d275d, 0x38b764, 0xb13e53, 0x333c57, 0x41a6f6, 0xef7d57, 0x94b0c2, 0xa7f070, 0xe06f8b, 0x73eff7, 0xffcd75, 0xf4f4f4
+	0x1a1c2c, 0x29366f, 0x3b5dc9, 0x1a1c2c, 0x5d275d, 0x38b764, 0xb13e53, 0x333c57, 0x41a6f6, 0xef7d57, 0x94b0c2, 0xa7f070, 0xe06f8b, 0x73eff7, 0xffcd75, 0xf4f4f4
 }
 function pal(v)
 	for i = 1, #basepalette do
@@ -126,36 +126,39 @@ end
 
 -- PARTICLE/VFX STUFF
 waterlevel = 120 -- y coordinate of the water
-particletype='rain' -- snow|rain|stars
+particletype='snow' -- snow|rain|stars
 particles = {}
 local starcolors = { 1, 2, 13, 15}
 function particleinit(numparticles)
+    -- initialize
+    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
-		for i = 0, numparticles do
-			table.insert(particles, {
-				x = math.random() * 240,
-				y = math.random() * waterlevel,
-				twinkle = math.random() > 0.49, -- randomly pick true/false
-				color = starcolors[math.random(#starcolors)],
-				t = 0,
-			})
-		end
-	end
-	if particletype == 'rain' or particletype == 'snow' then
-		for i = 0, numparticles do
-			color = 2
-			if particletype == 'snow' then color=15 end
-			table.insert(particles, {
-				x = math.random() * 240,
-				y = math.random() * waterlevel,
-				lastx = 0,
-				lasty = -3,
-				color = 2,
-				t = 0,
-				vel = (math.random() * 3) + 1,
-			})
+		for i = 1, #particles do
+			particles[i].twinkle = math.random() > 0.49 -- randomly pick true/false
+			particles[i].color = starcolors[math.random(#starcolors)]
 		end
 	end
+    if particletype == 'rain' then
+		for i = 1, #particles do
+            particles[i].vel = math.random(3) + 1
+        end
+    end
+    if particletype == 'snow' then
+		for i = 1, #particles do
+            particles[i].color = 15
+            particles[i].vel = math.random() + 0.2
+        end
+    end
 end
 
 function particleupdate()
@@ -181,7 +184,19 @@ function particleupdate()
 			p.lastx = p.x
 			p.y = p.y + p.vel
 		end
-	end
+    end
+    if particletype == 'snow' then
+		for i = 1,#particles do
+			local p = particles[i]
+			if p.y and p.y > 136 then
+				p.y = 0
+				p.lasty = 0
+				p.x = math.random() * 240
+			end
+            p.x = p.x + (math.random() - 0.5)
+            p.y = p.y + p.vel
+        end
+    end
 end
 
 function particledraw()