   ?                                 DDD     DDD	     DDD    DD     DDD      D @D   D     @DD     D @DD DDD$$  $DD $ $  D        DDD $ $ $DD $ $@ D     DDD$  $  $DD $  $  DDD     D @@ $ $ $DD$ D     D $@ $ $D  $ $@ D     @DD $ $D  @DD   $ $@DD                                 DDDDD  D  @  @  @  @D  DDDDD$"""$"""@"""@""" $"" $"" @"" @"""""""""""""""""""""""""""""""""""""B"""B""""""""B ""B "" ""                                                                                                                                                                                                                                                                                                                                                                                                                                   ""  "" """ """ """ """""""""""""""""""""""""    "" "" """ """ """"""""HHHDDHDDDDDDDD@D@DDDDDDDD                f    f    f    f    "   "          "                            " əDDDDDDDDDDDDDDDDDDDDDLLDDDDxwxwwwxxwww"x'"wwwwxw"ww("r)"""")̙iffi                                                     D@D@DDDDHDDDDD                f    f    f    f      "  " "" """"""""""B @@L@LL""LDDffffffffffffffffffffffffff"""""""""""""""""",",,",,wwwowogfgfffff````ffffJDDDfffff```ffffffff"""("w"xwwwwxwwxw"""(""wxwwwwxwwwIDDDDI̙                                                      ""3"311""""3""2""fffffffffffffffffffffffFfffFfffFffffffffffffffffffffdfffdfffdfFd833393  @D @DD  DD DDD DDD@DDD@DDDD  D @D  DD @DD DD@DDDDD@DDD
 
 


  


   					        ffffffffffffffffff ff ffffffffffffffffffffff ff`ff`fff` ff#"""1##""1fffFFdfFFdfFFdfFFdfFFdDFFdDFFdDFdfFddfFddDFddDFddDFddDFddDFddDFdDDDDDD@DDDDD@DDDDD@DDDDD@DDD@DDDDDDD@DDDDDDD@DDDDDDD@DDD


								   ffff`fff`fff`fffffffffffffffff` ff ff fff`ffffffffffffffffff       

 


 
        3333333333333033 3333333333333333333 033  0030 33003300330  fffffffffffff  ffffff`fff`fff`fffffffffffff`fffffff`fff`fff`333333333333 33330333 333333033333333330333  333333303303 3    ݻ   



 33 3 03 30 3330333333333333030333 0333333333333333333333      fff`f `f  f``f `fffffffffffffff`f  `f``f`f ` f ffffffff3 03  3 3003 3333333333333333330333033303  03333333333333333                   ffffffffffffffff`fff fffffff`fffffffffffffffffffff `ffff ff         					 	 	                    ff`f `f`f  ff `ffffffffffff ff ff `f@D`f  `ff ffffffffff        	 	  					                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   D  @  DO  D @D @O DO DD   O  D  DO  DO O OD ODO $"""@""" $""  ""  "" """ """""""""""""""""""""    """B"""""B "" "" """ !"                                                                                                                                                                                                                                                                                                                                                                @D@ODDDODDDDDDDODD@ DDDODODDODDODDODDDODDDODDD?   p  p  ww  ww pwwwwwwwwww ww          U                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ! "# $% &' () *+ ,- ./                                                                                                                                                                                                                         01 23 45 67 89 :; <= >?                                                                                                                                                                                                                                                                                                                                                                                                                                                  	
             @A BC DE FG HI JK LM NO                                                                                                                                                                                                                   PQ RS TU VW XY Z[ \] ^_                                                                                                                                                                                                                                                                                                                                                                                                                                                                         `a bc de fg hi jk lm no                                                                                                                                                                                                                         pq rs tu vw xy z{ |} ~                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 	>                                                                "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ffffffffffffffffffffffffffffffffffffffffffff                                                                                                                                                                                                                                                                                                                                                                                                                                   DDDDDD                          DDDDDDD                                                                                 DDDDDD                          DDDDDDD                                                                                 DDD DDDDDDD D     D  DDDDD  D"D DDDDDD  DDDDDDD   DDD   DDD   D  DDDDD                                          DDD DDDDDDD D     D  DDDDD  D"D DDDDDD  DDDDDDD   DDD   DDD   D  DDDDD                                          DD   D DD     DD   DD DD   D D"D     D"D   D D"D      DD  D  D"D  D  D"D   D                                         DD   D DD     DD   DD DD   D D"D     D"D   D D"D      DD  D  D"D  D  D"D   D                                         DD   D DD     DD D D DD   D D"DDDD  D"D   D D"D     D"D   D D"D D   D"DD                                            DD   D DD     DD D D DD   D D"DDDD  D"D   D D"D     D"D   D D"D D   D"DD                                            DD   D DDDDD  DDD  D DD   D D"D  D"DDDD  D"DDDD  D"D   D D"DD     DDDDD                                          DD   D DDDDD  DDD  D DD   D D"D  D"DDDD  D"DDDD  D"D   D D"DD     DDDDD                                          DD   D DD     DD   D DD   D D"D     D"D D   D"D     D"DDDDD D"D D       D"D                                         DD   D DD     DD   D DD   D D"D     D"D D   D"D     D"DDDDD D"D D       D"D                                         DDDDDD DD     DD   D DDD  D DDD     D"D  D  D"D     D"D   D D"D  D  D   D"D                                         DDDDDD DD     DD   D DDD  D DDD     D"D  D  D"D     D"D   D D"D  D  D   D"D                                           DDDDDDD DDD   D  DDDDD       DDD   D DDDDDDD DDD   D DDD   D  DDDDD                                            DDDDDDD DDD   D  DDDDD       DDD   D DDDDDDD DDD   D DDD   D  DDDDD                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ffffffffffffffffffffffffffffffffffffffffffff' -- title:   Demofreaks
-- author:  DallOner
-- desc:    A Collection of visual effects.
-- site:    https://dalloner.itch.io/
-- license: MIT License
-- version: 0.12
-- script:  lua
-- input:			gamepad

function BOOT()
	scn="warning"
	s=math.sin
	c=math.cos
	d=math.rad
	mr=math.random
	s60=s(60)
	ly=0
	sp=2
	am=4
	cr=circle
	w=240
	h=136
	x=0
	t=0
	f=0
	l=line
	a=136
	b=196
	cs={}
	rs={}
	yf=0
	fr=10
	am2=20
	pick={id=12,x=24,y=16,pos=1}
	p=pick.pos
	bD={}
	nB=16
	bW=15
	bS=1
	for i=1,nB do
		bD[i]={h=0,d=1,s=math.random(2,8)}
	end
end

function TIC()
	if scn=="title" then
		drw_title()
	elseif scn=="warning" then
		drw_warning()
	elseif scn=="menu" then
		drw_menu()
	elseif scn=="ballInAHole" then
		ballInAHole()
		if t<180 then
			drw_introBand()
		end
		goBack()
	elseif scn=="saw" then
		saw()
		goBack()
	elseif scn=="killThemAll" then
		killThemAll()
		if t<180 then
			drw_introBand()
		end
		goBack()
	elseif scn=="primalRenaissance" then
		primalRenaissance()
		if t<180 then
			drw_introBand()
		end
		goBack()
	elseif scn=="lostInTheSunrise" then
		lostInTheSunrise()
		if t<120 then
			drw_introBand()
		end
		goBack()
	elseif scn=="endlessRotation" then
		endlessRotation()
		if t<140 then
			drw_introBand()
		end
		goBack()
	elseif scn=="cytus" then
		cytus()
		if t<120 then
			drw_introBand()
		end
		goBack()
	elseif scn=="rain" then
		rain()
		if t<140 then
			drw_introBand()
		end
		goBack()
	elseif scn=="bloodChain" then
		bloodChain()
		if t<140 then
			drw_introBand()
		end
		goBack()
	elseif scn=="partyOn" then
		partyOn()
		if t<140 then
			drw_introBand()
		end
		goBack()
	elseif scn=="cyberwave" then
		cyberwave()
		if t<140 then
			drw_introBand()
		end
		goBack()
	elseif scn=="theWall" then
		theWall()
		if t<140 then
			drw_introBand()
		end
		goBack()
	end
end

function drw_title()
	cls(0)
	t=t+1
	-- Debug Text
	print("Title",8,16,0)
	print(t,216,8,0)
	-- Draw The Title
	line(72,48,160,48,4+t)
	map(10,7,10,7,w/2-80,h/2-16,0,2)
	line(72,72,160,72,4+t)
	
	if btnp(4) or btnp(5) then
		t=0
		scn="menu"
	end
end

function drw_menu()
	cls(1)
	--Draw the demos
	map(30,0,240,136,0,0,15)
	picker()
	movepicker()
	--Debug Text
	--print("Menu",8,8,12)
	--print(t,216,8,12)
	--print("pick #"..p,8,128,12)
end

function drw_introBand()
	rect(0,96,120,24,1)
	circ(120,108,11,1)
	if p==1 then
		print("Ball in a Hole",8,103,0)
		print("Ball in a Hole",8,102,12)
		print("(184 chars)",8,110,t)
	elseif p==2 then
		print("Saw",8,103,0)
		print("Saw",8,102,12)
		print("(255 chars)",8,110,t)
	elseif p==3 then
		print("Kill them All!",8,103,0)
		print("Kill them All!",8,102,12)
		print("(273 chars)",8,110,t)
	elseif p==4 then
		print("Primal Renaissance",8,103,0)
		print("Primal Renaissance",8,102,12)
		print("(219 chars)",8,110,t)
	elseif p==5 then
		print("Lost in the Sunrise",8,103,0)
		print("Lost in the Sunrise",8,102,12)
		print("(219 chars)",8,110,t)
	elseif p==6 then
		print("Endless Rotation",8,103,0)
		print("Endless Rotation",8,102,12)
		print("(255 chars)",8,110,t)
	elseif p==7 then
		print("Cytus",8,103,0)
		print("Cytus",8,102,12)
		print("(361 chars)",8,110,t)
	elseif p==8 then
		print("Rain",8,103,0)
		print("Rain",8,102,12)
		print("(245 chars)",8,110,t)
	elseif p==9 then
		print("Blood Chain",8,103,0)
		print("Blood Chain",8,102,12)
		print("(176 chars)",8,110,t)
	elseif p==10 then
		print("Party On!",8,103,0)
		print("Party On!",8,102,12)
		print("(222 chars)",8,110,t)
	elseif p==11 then
		print("Cyberwave",8,103,0)
		print("Cyberwave",8,102,12)
		print("(253 chars)",8,110,t)
	elseif p==12 then
		print("The Wall",8,103,0)
		print("The Wall",8,102,12)
		print("(255 chars)",8,110,t)
	end
end

function drw_warning()
	map(60,0,240,136,0,0,15)
	print("Warning!",w/2-19,38,4)
	print("This program contains visual effects,",w/2-98,56,12)
	print("flash colors, and images, these may", w/2-94,70,12)
	print("bother people with photosensitivity.",w/2-96,84,12)
	print("If you suffer photosensitive epilepsy,",w/2-102,108,12)
	print("please DO NOT use this program.",w/2-84,120,2)
	
	if btnp(4) or btnp(5) then
		t=0
		scn="title"
	end 
end

function picker()
	--Drw the Title n Picker in Position
	if p==1 then
		print("Ball in a Hole", w/2-40,12,12)
		rectb(24,32,16,16,4)
	elseif p==2 then
		print("Saw", w/2-16,12,12)
		rectb(48,32,16,16,4)
	elseif p==3 then
		print("Kill them all!", w/2-40,12,12)
		rectb(72,32,16,16,4)
	elseif p==4 then
		print("Primal Renaissance", w/2-54,12,12)
		rectb(96,32,16,16,4)
	elseif p==5 then
		print("Lost in the Sunrise", w/2-56,12,12)
		rectb(120,32,16,16,4)
	elseif p==6 then
		print("Endless Rotation", w/2-50,12,12)
		rectb(144,32,16,16,4)
	elseif p==7 then
		print("Cytus", w/2-18,12,12)
		rectb(168,32,16,16,4)
	elseif p==8 then
		print("Rain", w/2-16,12,12)
		rectb(192,32,16,16,4)
	elseif p==9 then
		print("Blood Chain", w/2-32,12,12)
		rectb(24,56,16,16,4)
	elseif p==10 then
		print("Party On!", w/2-29,12,12)
		rectb(48,56,16,16,4)
	elseif p==11 then
		print("Cyberwave", w/2-29,12,12)
		rectb(72,56,16,16,4)
	elseif p==12 then
		print("The Wall", w/2-28,12,12)
		rectb(96,56,16,16,4)
	elseif p==13 then
		print("TBD", w/2-16,12,12)
		rectb(120,56,16,16,4)
	elseif p==14 then
		print("TBD", w/2-16,12,12)
		rectb(144,56,16,16,4)
	elseif p==15 then
		print("TBD", w/2-16,12,12)
		rectb(168,56,16,16,4)
	elseif p==16 then
		print("TBD", w/2-16,12,12)
		rectb(192,56,16,16,4)
	elseif p==17 then
		print("TBD", w/2-16,12,12)
		rectb(24,80,16,16,4)
	elseif p==18 then
		print("TBD", w/2-16,12,12)
		rectb(48,80,16,16,4)
	elseif p==19 then
		print("TBD", w/2-16,12,12)
		rectb(72,80,16,16,4)
	elseif p==20 then
		print("TBD", w/2-16,12,12)
		rectb(96,80,16,16,4)
	elseif p==21 then
		print("TBD", w/2-16,12,12)
		rectb(120,80,16,16,4)
	elseif p==22 then
		print("TBD", w/2-16,12,12)
		rectb(144,80,16,16,4)
	elseif p==23 then
		print("TBD", w/2-16,12,12)
		rectb(168,80,16,16,4)
	elseif p==24 then
		print("TBD", w/2-16,12,12)
		rectb(192,80,16,16,4)
	elseif p==25 then
		print("TBD", w/2-16,12,12)
		rectb(24,104,16,16,4)
	elseif p==26 then
		print("TBD", w/2-16,12,12)
		rectb(48,104,16,16,4)
	elseif p==27 then
		print("TBD", w/2-16,12,12)
		rectb(72,104,16,16,4)
	elseif p==28 then
		print("TBD", w/2-16,12,12)
		rectb(96,104,16,16,4)
	elseif p==29 then
		print("TBD", w/2-16,12,12)
		rectb(120,104,16,16,4)
	elseif p==30 then
		print("TBD", w/2-16,12,12)
		rectb(144,104,16,16,4)
	elseif p==31 then
		print("TBD", w/2-16,12,12)
		rectb(168,104,16,16,4)
	end
end

function movepicker()
	if btnp(3) then
		p=p+1
	elseif btnp(2) then
		p=p-1
	elseif btnp(0) then
		p=p-8
	elseif btnp(1) then
		p=p+8
	end
	
	if p<1 then
		p=31
	elseif p>31 then
		p=1
	end
	
	--Jump to a Demoscene
	if btnp(4) then
		if p==1 then
			scn="ballInAHole"
		elseif p==2 then
			scn="saw"
		elseif p==3 then
			scn="killThemAll"
		elseif p==4 then
			scn="primalRenaissance"
		elseif p==5 then
			scn="lostInTheSunrise"
		elseif p==6 then
			scn="endlessRotation"
		elseif p==7 then
			scn="cytus"
		elseif p==8 then
			scn="rain"
		elseif p==9 then
			scn="bloodChain"
		elseif p==10 then
			scn="partyOn"
		elseif p==11 then
			scn="cyberwave"
		elseif p==12 then
			scn="theWall"
		end
	end
end

function goBack()
	if btnp(5)then
		t=0
		BOOT()
		scn="menu"
	end
end

------------------------
--- WHOLE SECTION OF ---
--- VFXs Collection  ---
------------------------
function ballInAHole()
cls()t=time()//64
m=math 
x=m.sin(90+t*8)y=m.cos(90-t/80)
for w=0,240 do for h=0,140 do
	r=m.random(1,16)
	circb(x*239,y*64,r,t//8)ellib(x*16,y,x*32,y*t,t*8)
end end
end

function saw()cls()t=t+1x=0+t/399y=0+t/12
a=s(x)+c(y)
for y=0,h do
for x=0,w do
q=s(x*8+t/2,y*12,t%4)+c(x*8,y*12,t%8)
pix(x,y*2,q*4+t/8)
if t<h then t=t-1 end
if t>0 then t=t+1 end
end end
print("Saw",w/2-8,h/2-8,12)
end

function killThemAll()t=t+1
m1=mr(1,a)m2=mr(1,240)cls()for w=0,240 do
for h=1,a do
l(m2+mr(a,b),m1+mr(a,b),m2+mr(a,240)*s60,m1+mr(1,a)*s60,12)l(m1+32*w,m1*w,m2*8/64,m2+mr(1,64)/2,2)l(m2+mr(a,b),m1+mr(a,b),m2+b*s60,m2+b*s60,4)
end
end
end

function primalRenaissance()
cls(12)t=t+1
for i=0,60 do
for e=0,t*2,200 do
rectb(0,0,mr(8,120),mr(8,68),9)rectb(256,0,-mr(8,h),mr(32,68),4)rectb(248,68,-mr(8,128),mr(8,96),2)rectb(0,68,mr(16,120),mr(16,h),6)
end end
end

function lostInTheSunrise()
cls(0)
t=t+1
for y=1,96 do
for x=1,240 do
pix(x*2,y*2+96,5)
pix(mr(1,240),mr(96,136),6)
pix(mr(196,214),mr(80,96),4)
pix(x,y,11)
pix(x,mr(1,y),10)
end end
spr(257,24,88,0,2)
spr(256,8,91,0,2)
spr(256,40,91,0,2)
spr(257,56,88,0,2)
end

function endlessRotation()cls(8)t=t+1
cx=120
cy=68
ng=6
r=20+10*s(t*.05)
circ(cx,cy,r,0)
as=360/ng
ar=t*.7
for i=1,ng do
x=cx+r*2*c(d(as*i+ar))
x2=cx+r*10*c(d(as*i+ar))
y=cy+r*2*s(d(as*i+ar))
circ(x,y,r,t/2)
circ(x2,68,r,2)
end
end

function cytus()cls(9)for i,cr in ipairs(cs) do
circ(cr.x,cr.y,cr.r,cr.co)
circb(cr.x,cr.y,cr.r-1,0)
cr.r=cr.r-.2 
if cr.r<=0 then table.remove(cs,i)end
end
if mr(100)<5 then
cr={x=mr(240),y=mr(136),r=mr(10,30),co=mr(1,16)}
table.insert(cs,cr)
end
line(0,ly,240,ly,12)ly=ly+am*s(time()*.0036)
if ly<0 or ly>136 then sp=-sp end
t=t+1
end

function rain()cls()
if mr(100)<22 then
r={x=mr(5,235),y=0,len=mr(5,15),spd=mr(2,6)}
table.insert(rs,r)
end
for i,r in ipairs(rs) do
r.y=r.y+r.spd
line(r.x,r.y,r.x,r.y+r.len,15)
if r.y>136+r.len then
table.remove(rs,i)
end end
t=t+1
end

function bloodChain()
t=t+1
cls(1)
yf=yf+1
for x=0,239,10 do
y1=68+s((x+yf)/fr)*am2
y2=68+s((x+10+yf)/fr)*am2
line(x,y1,x+10,y2,3)
line(-x,y1,x+10,y2,2)
end end

function partyOn()cls(6)
t=t+1
for i,b in ipairs(bD) do
b.h=b.h+b.s*b.d
if b.h>=136 or b.h<=0 then
b.d=-b.d
end
rect((i-1)*(bW+bS),135-b.h,bW,b.h,4)
end
end

function cyberwave()cls(15)t=t+1
if f==0 then cls()end
x=36+s(math.rad(f))*100+f
y=56+s(math.rad(f))*-40
circ(x,y,8,3)f=f+.1
if f>90 then f=90 end
for x=0,19 do
line(40,64,s(x)*240+t,136,11)tri(8-t/20+x*17,48,0+x*17,64,24+x*17,64,9)
end
end

function theWall()cls(4)t=t+1
for x=0,239 do
for y=0,135 do
line(0,s(136)*y,120,68,0)line(120,68,240,s(136)*y,0)line(0,136,120,68,0)line(120,68,240,136,0)
end end
mx=90
mn=12
gs=1
ti=time()/1000
z=mn+((mx-mn)*0.5*(1+s(ti*gs)))cX=120
cY=68
rect(cX-z/2,cY-z/2,z,z,0)
end