Browse Source

consolidating level data

pixelbath 3 years ago
parent
commit
ac7098b8db
1 changed files with 65 additions and 233 deletions
  1. 65 233
      alter-ego-by-kyuchumimo.lua

+ 65 - 233
alter-ego-by-kyuchumimo.lua

@@ -64,20 +64,45 @@ options = {
 	debug = true,
 }
 
+leveldata = {
+	{ name='title' },
+	{ name='hello world',      s=2, px=3, aepx=0, aeo=0, animx=21, animy=3 },
+	{ name='promenade',        s=2, px=8, aepx=0, aeo=0, animx=5, animy=3 },
+	{ name='broken bridge',    s=0, px=8, aepx=0, aeo=0, animx=11, animy=3 },
+	{ name='phantom pixels',   s=3, px=2, aepx=4, aeo=0, animx=14, animy=3 },
+	{ name='another phantom',  s=4, px=13, aepx=0, aeo=1, animx=3, animy=10 },
+	{ name='skulls lair',      s=2, px=14, aepx=0, aeo=0, animx=17, animy=13 },
+	{ name='abracadabra',      s=2, px=6, aepx=6, aeo=0, animx=9, animy=10 },
+	{ name='vertical illusions', s=8, px=10, aepx=0, aeo=1, animx=4, animy=9 },
+	{ name='mirrors',          s=2, px=4, aepx=3, aeo=0, animx=26, animy=11 },
+	{ name='16 pixels',        s=4, px=16, aepx=0, aeo=0, animx=5, animy=9 },
+	{ name='perfect reflect',  s=1, px=16, aepx=0, aeo=0, animx=15, animy=10 },
+	{ name='icelands',         s=3, px=5, aepx=3, aeo=0, animx=15, animy=9 },
+	{ name='midnight',         s=2, px=5, aepx=0, aeo=0, animx=23, animy=12 },
+	{ name='alone skull',      s=3, px=3, aepx=2, aeo=0, animx=15, animy=2 },
+	{ name='made in heaven',   s=5, px=9, aepx=6, aeo=1, animx=4, animy=4 },
+	{ name='underwater',       s=2, px=3, aepx=5, aeo=0, animx=2, animy=9 },
+	{ name='zupapixels',       s=9, px=8, aepx=1, aeo=0, animx=3, animy=2 },
+	{ name='skullopedia',      s=4, px=12, aepx=0, aeo=0, animx=7, animy=12 },
+	{ name='after the war',    s=3, px=8, aepx=0, aeo=1, animx=3, animy=2 },
+	{ name='vuris knvartirus', s=6, px=11, aepx=0, aeo=0, animx=24, animy=13 },
+	{ name='the end',          s=143, px=-255, aepx=-255, aeo=0, animx=-1, animy=-2 },
+}
+
 cls()
 map()
 
 --PALETTE STUFF
 local basepalette = {
-    0x1a1c2c, 0x29366f, 0x3b5dc9, 0x493c2b, 0x5d275d, 0x38b764, 0xb13e53, 0x333c57, 0x41a6f6, 0xef7d57, 0x94b0c2, 0xa7f070, 0xe06f8b, 0x73eff7, 0xffcd75, 0xf4f4f4
+	0x1a1c2c, 0x29366f, 0x3b5dc9, 0x493c2b, 0x5d275d, 0x38b764, 0xb13e53, 0x333c57, 0x41a6f6, 0xef7d57, 0x94b0c2, 0xa7f070, 0xe06f8b, 0x73eff7, 0xffcd75, 0xf4f4f4
 }
 function pal(v)
-    for i = 1, #basepalette do
-        local offset, color = i-1, basepalette[i]
-        poke(0x3fc0+(offset*3), ((color//65536) * v))
-        poke(0x3fc1+(offset*3), ((color//256)%256) * v)
-        poke(0x3fc2+(offset*3), (color%256) * v)
-    end
+	for i = 1, #basepalette do
+		local offset, color = i-1, basepalette[i]
+		poke(0x3fc0+(offset*3), ((color//65536) * v))
+		poke(0x3fc1+(offset*3), ((color//256)%256) * v)
+		poke(0x3fc2+(offset*3), (color%256) * v)
+	end
 end
 
 function fade_out(et)
@@ -105,31 +130,31 @@ particletype='rain' -- snow|rain|stars
 particles = {}
 local starcolors = { 1, 2, 13, 15}
 function particleinit(numparticles)
-    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
+	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,
+			table.insert(particles, {
+				x = math.random() * 240,
 				y = math.random() * waterlevel,
 				lastx = 0,
 				lasty = -3,
-                color = 2,
+				color = 2,
 				t = 0,
 				vel = (math.random() * 3) + 1,
 			})
-        end
+		end
 	end
 end
 
@@ -203,7 +228,7 @@ function skullh(shx,shy,shf,sht)
 	--print((shy*8)+8,22,30)
 
 end
-	
+
 --LEVEL PROPERTIES (ANIMX/Y LIMITS(1-28,1-14))
 function level(m)
 	c=0
@@ -215,219 +240,26 @@ function level(m)
 	et=-255
 	strig=0
 	ftrig=0
-	
-	--HELLO WORLD
-	if m==2 then
-		t=0
-		s=2
-		px=3
-		aepx=0
-		aeo=0
-		animx=21
-		animy=3
-	end
-	
-	--PROMENADE
-	if m==3 then
-		s=2
-		px=8
-		aepx=0
-		aeo=0
-		animx=5
-		animy=3
-	end
-
-	--BROKEN BRIDGE
-	if m==4 then
-		s=0
-		px=8
-		aepx=0
-		aeo=0
-		animx=11
-		animy=8
-	end
-	
-	--PHANTOM PIXELS
-	if m==5 then
-		s=3
-		px=2
-		aepx=4
-		aeo=0
-		animx=14
-		animy=3
-	end	
-
-	--ANOTHER PHANTOM
-	if m==6 then
-		s=4
-		px=13
-		aepx=0
-		aeo=1
-		animx=3
-		animy=10
-	end
-
-	--SKULLS LAIR
-	if m==7 then
-		s=2
-		px=14
-		aepx=0
-		aeo=0
-		animx=17
-		animy=13
-	end
-	
-	--ABRACADABRA
-	if m==8 then
-		s=2
-		px=6
-		aepx=6
-		aeo=0
-		animx=9
-		animy=10
-	end
-					
-	--VERTICAL ILLUTIONS
-	if m==9 then
-		s=8
-		px=10
-		aepx=0
-		aeo=1
-		animx=4
-		animy=9
-	end
 
-	--MIRRORS
-	if m==10 then
-		s=2
-		px=4
-		aepx=3
-		aeo=0
-		animx=26
-		animy=11
-	end
-
-	--16 PIXELS
-	if m==11 then
-		s=4
-		px=16
-		aepx=0
-		aeo=0
-		animx=5
-		animy=9
-	end
-
-	--PERFECT REFLECT
-	if m==12 then
+	--HELLO WORLD, PERFECT REFLECT, END
+	if m==2 or m==12 or m==22 then
 		t=0
-		s=1
-		px=16
-		aepx=0
-		aeo=0
-		animx=15
-		animy=10
-	end
-
-	--ICELANDS
-	if m==13 then
-		s=3
-		px=5
-		aepx=3
-		aeo=0
-		animx=15
-		animy=9
-	end
-
-	--MIDNIGHT
-	if m==14 then
-		s=2
-		px=5
-		aepx=0
-		aeo=0
-		animx=23
-		animy=12
-	end
-	
-	--ALONE SKULL
-	if m==15 then
-		s=3
-		px=3
-		aepx=2
-		aeo=0
-		animx=15
-		animy=2
-	end
-
-	--MADE IN HEAVEN
-	if m==16 then
-		s=5
-		px=9
-		aepx=6
-		aeo=1
-		animx=4
-		animy=4
-	end
-
-	--UNDERWATER
-	if m==17 then
-		s=2
-		px=3
-		aepx=5
-		aeo=0
-		animx=2
-		animy=9
-	end
-
-	--ZUPAPIXELS
-	if m==18 then
-		s=9
-		px=8
-		aepx=1
-		aeo=0
-		animx=3
-		animy=2
 	end
 	
-	--SKULLOPEDIA
-	if m==19 then
-		s=4
-		px=12
-		aepx=0
-		aeo=0
-		animx=7
-		animy=12
-	end
-
-	--AFTER THE WAR
-	if m==20 then
-		s=3
-		px=8
-		aepx=0
-		aeo=1
-		animx=3
-		animy=2
+	if m > 0 then
+		local data = leveldata[m]
+		s = data.s
+		px = data.px
+		aepx = data.aepx
+		aeo = data.aeo
+		animx = data.animx
+		animy = data.animy
 	end
 
-	--VIRUS KVARTIRUS
-	if m==21 then
-		s=6
-		px=11
-		aepx=0
-		aeo=0
-		animx=24
-		animy=13
-	end
-	
 	--END
 	if m==22 then
-		t=0
 		l=143
 		s=143
-		px=-255
-		aepx=-255
-		aeo=0
-		animx=-1
-		animy=-2
 		mset((30*m%240)+(animx*8+(anix//10))//8,(17*(m//8))+((animy*8+(aniy//10))//8),1)
 		mset(((30*m%240)+(animx*8+(anix//10))//8)-1,(17*(m//8))+((animy*8+(aniy//10))//8)+1,1)
 		mset((30*m%240)+(animx*8+(anix//10))//8,(17*(m//8))+((animy*8+(aniy//10))//8)+2,1)
@@ -481,7 +313,7 @@ function TIC()
 		l=5
 		--REMAP
 		cls()
-        particleupdate()
+		particleupdate()
 		particledraw()
 
 		map(30*m%270,17*((m-1)//8),30,17,0,0,0,1)
@@ -513,8 +345,8 @@ function TIC()
 		fade_in(0)
 		--REMAP
 		cls()
-        particleupdate()
-        particledraw()
+		particleupdate()
+		particledraw()
 		map(30*m%240,17*(m//8),30,17,0,0,0,1,
 			function(tile)
 				if tile>=80 and tile<=111 and anix==0 and aniy==0 and px==0 and aepx==0 then
@@ -527,7 +359,7 @@ function TIC()
 				end
 			end
 		)
-    
+
 	--PIXELS DISPLAY
 	map(30*m%240,17*(m//8),30,17,0,0,0,1,
 		function(tile)
@@ -563,7 +395,7 @@ function TIC()
 	--skullh(12,10,0,0)
 	--if btn(5) then	skullh(25,3,0,0) end
 	--skullh(20,6,0,0)
-	
+
 	--LEVEL CLEAR
 	if px==0 and aepx==0 and anix==0 and aniy==0 then
 		if et<0 then
@@ -590,7 +422,7 @@ function TIC()
 		end
 		if t<et+(3*60) then
 		return end
-	 m=m+1
+		m=m+1
 		t=1
 		level(m)
 	end
@@ -722,7 +554,7 @@ function TIC()
 				else
 					sfx(59,60,-1,3)
 				end
-            end
+			end
 		end
 		if btnp(6) and m<=21 then
 			m=m+1
@@ -935,4 +767,4 @@ function TIC()
 	end --if options.debug
 
 	--end of function TIC()
-end
+end