0Òгª‡3€7ÿÒгðp8·d%qy)6o;]ÉA¦ösï÷ôôô”°ÂVl†3>???????????????????@AAABBCCCDDDDEEEFFGHHIIJJKKLMMN„CTUVVWXYZ[\]]]^^_______________tB BCµ€@€@€@€`€` € €@€@ € $ À €@€@€@€@€`€` € €@ €@€@€@ €@ €@€@€@€ €¦€¦ €¦€¦€¦€¦ €¦€¦€¦€¦ €¦€¦ €†€†€¦ €¦ €†€†€¦ €¦ €†€†€¦ €¦€¦ €¦ €¦€Æ€¦ €¦ €¦€Æ€¦ €¦ €¦€Æ €†€¦€¦ €¦ €†€¦€¦ €¦ €†€¦€¦ €¦õŸ…Æ…@@d à…@dी…€…`f à… €…€…€…€…€…®š…€…Ž˜…€…n–…€…ôŸD„˜ã€ãôŸ‚„˜ã€ãôŸD€D„˜ã€ãôŸ‚€DôŸD„˜ã€ãôŸ‚„˜ã€ãôŸD€D„˜ã€ãôŸ‚€D€‚ôŸD„˜ã€ãôŸ‚„˜ã€ãôŸD€D„˜ã€ãôŸ‚€DôŸD„˜ã€ãôŸ‚„˜ã€ãôŸD€D„˜ã€ãôŸ‚€D€‚õŸ…Æ…@@d à…@dी…€…`f à… €…€…€…€…`fà… €… €… €… €…€¥Â…@õŸ‡Ƈ@@d à‡@dà§€‡€‡`f à‡ €‡€‡€‡€‡€‡€‡€‡€‡€‡€‡€‡€‡€‡ €gõŸ‡Ƈ@@d à‡@dà§€‡€‡`f à‡€‡€‡`f` €‡ €‡€§PeTÅG`@€¦€¦ €¦€¦€¦€¦ €¦€¦€¦€¦ €¦€¦ €†€†€¦ €¦ €†€†€¦ €¦ €†€†€¦ €¦€¦ €¦ €¦€Æ€¦ €¦ €¦€Æ€¦ €¦ €¦€Æ€‡€‡€‡Pe[Å'`@ € €@€@ € € € € €@€@€ €@€ € €@€@€ €@€ € € € €@ €@ € €@€@€@€¨€¨ €¨€¨ €¨ €¨€¨Pg`€¨€¨ €¨€¨ €¨€¨€¨Pg€¨`€i€i €i €i€‰ €i €i€i€i€i €i €i€‰ €i €i€i€I€i€i €i€i €i€i€i€I€i€i €i€i €i€i€i€i €i€i€‰€‰€‰€i €i€i €i€i€‰€‰€‰€i €i €I€i€i €i€i €i€i€i €I€i€i €i €I€i€i €i€¨€¨ €¨€¨ €¨ €¨€¨Pg`€¨€¨ €¨€¨ €¨€¨ €¨Pg€È`üŸgÆg@@dà‡@d à‡ €‡ €‡`fà‡€‡ €g €g €g €g €g €g €g €g €g €g €g €g€güŸgÆg@@dà‡@d à‡ €‡ €‡`fà‡ €‡ €‡`fà‡Pe[Å`@0õŸ‡Ƈ@@d à‡@dà§€‡€‡`f à‡€‡€§`fà§PeTÅ'`@€@€@€`€` € €@€@ € € €@€ €@ €@ €@€@€@€@€@ €@ €@÷Ÿ… Æ…@@d à…@dी¥€¥`f à… €…€…€…€…€h à… €…€†€† €† €†€†€† €† €† €† €†€¦€¦ €† €† €† €† €f €f€†€† €f €f€†€†€†€† €† €†€†€†€†€†€†€† €† €†€†€†€†€† €† €†€¦€¦€†€† €† €†€†€†€¦€¦€†€† €¦ €¦€¦€¦ €¦ €¦ €¦ €¦€¦€¦ôŸDd–ãôŸ‚d–ãôŸDd–ãôŸ‚d–ãôŸDd–ãôŸ‚d–ãôŸDd–ãôŸ‚d–ãôŸDd–ãôŸ‚d–ãôŸDd–ãôŸ‚d–ãôŸDd–ãôŸ‚d–ãôŸDd–ãôŸ‚d–ã÷Ÿ… Æ…@@d à…@dी¥€¥`f à… €…€…€…€…€hà…€…€… €… €… €… à…€… €…÷Ÿ… Æ…@@d à…@dी¥€¥`f à… €…€…€…€…€hà…€…€… €…€…€¥€j`þŸgƇ@@dà‡@d à‡ €‡`fà‡€‡ €g `P@  €g `P@  €g `P@  ôŸDd–ãôŸ‚d–ãôŸDd–ãôŸ‚d–ãôŸDd–ãôŸ‚d–ãôŸDd–ãôŸ‚d–ãôŸDd–ãôŸ‚d–ãôŸDd–ãôŸ‚d–ãôŸDd–ãôŸ‚d–ãôŸDd–ãôŸ‚€‚däc  Á A!!Á‰² ³Á A!ÑÁã MP$M%MP$MP%MÖ…eQ?" 03 " 0 0 30 " 03 "030033 " 0"03 "  " 03 0 "3 000 " " 1131133333#113113 "033 33"133333333 313131333333333313311331313133113133333 "3133131313331333333333131113031313313331 "1313333313333 13131313333"33333133303113 3131131333113133313313333313313113333331311331133011311313031331301333133313313133313133303333333333333303333333333333333333303333333333333333033333333333333333333303003 0003 0 03"""   "" 030 03"30331 0031111311313 "01333033030000033033333333033330333 "0 " 0 "03300003030 "0 "00 30330030  "03 "0 "  "03030¾F-- title: Vectral -- author: SRB2er -- desc: Fly around and get power! -- site: website link -- license: MIT License (change this to your license of choice) -- version: 0.1 -- script: lua --palette from marrow4 lospec function INIT() plyr={ x=120, y=150, vx=0, vy=0, spd=2, ctrl=false, pow=100, ship={4,-4,4,4,-4,-1}, xsc=1.5, ysc=3, show=true, powSpawn=0, ft=0, --fire time(r) ift=0, -- i frames timer dt=0, --death timer dat=0-- dash timer (i need to find a better method for this) } buls={} enems={} ebuls={} stars={} parts={} pows={} boss={} got=0 nwt=0 tit=0 mgt=0 mgtof=0 int=0 wave=1 score=0 hscore=pmem(0) or 0 --high score debug=false insert=table.insert remove=table.remove rnd=math.random sin=math.sin cos=math.cos atan2=math.atan2 abs=math.abs pal1="190700D2D0B3AA8733803715" end gameState="intro" INIT() --vector code made all by myself :) function vector(x1,y1,tbl,col,xscal,yscal,rot) rot=rot or 0 xscal=xscal or 1 yscal=yscal or 1 local lastX,lastY=x1,y1--starting x and y if #tbl%2==0 then for i=1,#tbl,2 do line(lastX, lastY, lastX+(tbl[i])*xscal, lastY+(tbl[i+1])*yscal,col) lastX=(tbl[i]*xscal)+lastX lastY=(tbl[i+1]*yscal)+lastY end end --this closes the vector shape line(lastX,lastY,x1,y1,col) end --collision detection function col(a,aw,ah,b,bw,bh,awo,aho,bwo,bho) awo=awo or 0 aho=aho or 0 bwo=bwo or 0 bho=bho or 0 local a_left,a_top,a_right,a_bottom=a.x+awo,a.y+aho,a.x+aw+awo,a.y+ah+aho local b_left,b_top,b_right,b_bottom=b.x+bwo,b.y+bho,b.x+bw+bwo,b.y+bh+bho if debug==true then rect(a_left,a_top,aw,ah,2) rect(b_left,b_top,bw,bh,2) end if a_top>b_bottom then return false end if b_top>a_bottom then return false end if a_left>b_right then return false end if b_left>a_right then return false end return true --wait wha end --picoview lerp theft function exLerp(from, to, weight) local dist = to - from if (abs(dist) < 0.2) then return to end return from + (dist * weight) end function initBoss(bx,by,btyp) local bos={ x=bx, y=by, vx=0, vy=0, age=0, typ=btyp, } if btyp==0 then bos.vec={0,8, 2,-2, 2,2, 4,-8} bos.hp=100 end insert(boss,bos) end function bossUpdDrw() for k, b in pairs(boss) do --crown(?) guy flies left and right firing stuff in a certain order if b.typ==0 then if b.age<240 then b.y=exLerp(b.y,2,0.1) elseif b.age>=120 then b.vy=sin(mgt/2) end if b.age%600>=180 and b.age%600<460 then if b.age%45==0 then for i=0,15 do initEnemBul(b.x+15,b.y+30,0,0,2,false,cos(2*math.pi*i/16+b.age),sin(2*math.pi*i/16+b.age)) initPart(b.x+15,b.y+30,10,1,1,0,0,0,0) end end end for k2,bu in pairs(buls) do if col(b,30,30,bu,3.5*bu.xsc,2*bu.ysc,0,0,-4,-3) and b.y>-1 then sfx(35,"F#4",6,3,9,-1) remove(buls,k2) b.hp=b.hp-1 score=score+50 plyr.powSpawn=plyr.powSpawn+0.5 if plyr.powSpawn==5 then initPow(b.x+15,b.y+15,0) plyr.powSpawn=0 end end end if plyr.ift==0 and plyr.dat==0 and col(b,30,30,plyr,6*plyr.xsc,3*plyr.ysc,0,0,2,-11) then plyr.ift=120 end if b.hp==0 then wave=wave+1 nwt=0 mgtof=mgt score=score+1000 for i=0,31 do initPart(b.x+15,b.y+15,30,0.5,1,false,1,2*cos(2*math.pi*i/8),2*sin(2*math.pi*i/8)) end remove(boss,bo) end if b.hp>0 then b.x=120+40*cos(mgt/30) end b.age=b.age+1 if (b.age%600>=120 and b.age%600<180) or (b.age%600>=180 and b.age%600<450 and b.age%45>=15)then vector(b.x,b.y,b.vec,2+sin(b.age/2),4,4) else vector(b.x,b.y,b.vec,1,4,4) end end end end function initEnem(ex,ey,evx,evy,etyp,exsc,eysc) local en={ x=ex, y=ey, vx=evx, vy=evy, typ=etyp, xsc=exsc, ysc=eysc, age=1, ft=0, } if etyp==0 then --simple triangle en.vec={2,0,-1,1} en.hp=2 en.spawnY=rnd(1,3)*6 en.xo=-0 en.yo=-3 elseif etyp==1 then --aiming square en.vec={2,0,0,2,-2,0} en.hp=3 en.spawnY=rnd(0,2)*6 en.xo=0 en.yo=0 elseif etyp==2 then --all around diamond en.vec={1,-1,1,1,-1,1,-1,-1} en.hp=2 en.spawnY=rnd(1,3)*6 en.xo=0 en.yo=-3 end insert(enems,en) end function enemUpdDrw() for k,e in pairs(enems) do if e.typ==0 then --simple guy if e.y<=e.spawnY and e.age<300 then e.y=exLerp(e.y,e.spawnY,0.1) elseif e.age>=300 then e.vy=1 e.wait=100 end e.wait=e.wait or rnd(60,150) e.wait=e.wait-1 if e.ft>=1 then e.ft=e.ft-1 end if e.wait<20 then e.x=e.x+2*sin(mgt) end if e.wait==0 and e.vy==0 then e.wait=rnd(60,150) e.ft=10 initEnemBul(e.x+4,e.y+8,1,2,4,false,0,1.5) end circ(e.x+4,e.y+5,(e.ft/2)-1,1) elseif e.typ==1 then --square can aim omg if e.y<=e.spawnY and e.age<240 then e.y=exLerp(e.y,e.spawnY,0.1) elseif e.age>=240 then e.vy=exLerp(e.vy,-2,0.1) e.wait=22 end e.wait=e.wait or rnd(60,150) e.wait=e.wait-1 if e.ft>1 then e.ft=e.ft-1 end if e.wait<20 then e.x=e.x+2*sin(mgt) end if e.wait==0 and e.vy==0 then local pi=math.pi e.wait=rnd(60,150) e.ft=10 initEnemBul(e.x+4,e.y+ 5, (atan2(plyr.x-e.x,plyr.y-e.y)), 1.5,2,true) end circ(e.x+4,e.y+10,(e.ft/2)-1,1) elseif e.typ==2 then --diamond scary if e.y<=e.spawnY and e.age<180 then e.y=exLerp(e.y,e.spawnY,0.1) elseif e.age>=180 then e.vy=exLerp(e.vy,-2,0.1) e.wait=22 end e.wait=e.wait or 125 e.wait=e.wait-1 if e.ft>1 then e.ft=e.ft-1 end if e.wait<40 then e.x=e.x+2*sin(mgt) e.y=e.y+2*cos(mgt/2) end if e.wait==0 and e.vy==0 then local pi=math.pi e.wait=rnd(60,150) e.ft=10 for i=0,7 do --2*cos(2*math.pi*i/8) initEnemBul(e.x+2,e.y,0,0,2,false,cos(2*math.pi*i/8),sin(2*math.pi*i/8)) end end circ(e.x+4,e.y+5,(e.ft/2)-1,1) end --main stuff --hurty if (plyr.ift==0 and plyr.dat==0) and col(e,2.25*e.xsc,2*e.ysc,plyr,6*plyr.xsc,3*plyr.ysc,e.xo,e.yo,2,-11) then plyr.ift=120 end for k2,b in pairs(buls) do if col(e,2.25*e.xsc,2*e.ysc,b,3.5*b.xsc,2*b.ysc,e.xo,e.yo,-4,-3) and e.y>-1 then sfx(35,"F#4",6,3,9,-1) remove(buls,k2) e.hp=e.hp-1 score=score+50 end end if e.y>=146 or e.y<-28 then remove(enems,k) elseif e.hp<=0 then score=score+1000 plyr.powSpawn=plyr.powSpawn+1 if plyr.powSpawn==5 then initPow(e.x+4,e.y+2,0) plyr.powSpawn=0 end for i=0,7 do initPart(e.x+3,e.y+3,10,0.5,1,false,1,2*cos(2*math.pi*i/8),2*sin(2*math.pi*i/8)) end remove(enems,k) end e.x=e.x+e.vx e.y=e.y+e.vy e.age=e.age+1 vector(e.x,e.y,e.vec,1,e.xsc,e.ysc) end end function initBul(bx,by,bvx,bvy,bxsc,bysc,btyp) local bu={ x=bx, y=by, vx=bvx, vy=bvy, xsc=bxsc, ysc=bysc, typ=btyp, vec={1,1,-1,1,-1,-1}, } insert(buls,bu) end function bulUpdDrw() for k, b in pairs(buls) do b.x=b.x+b.vx b.y=b.y+b.vy if b.y<=-16 then remove(buls,k) end vector(b.x,b.y,b.vec,1,b.xsc,b.ysc) end end function initEnemBul(ex,ey,eang,espd,er,aim,evx,evy) local eb={ x=ex, y=ey, r=er, } if aim==true then eb.vx=sin(eang)*espd eb.vy=cos(eang)*espd elseif aim==false then eb.vx=evx eb.vy=evy end insert(ebuls,eb) end function enemBulUpdDrw() for k, eb in pairs(ebuls) do eb.x=eb.x+eb.vx eb.y=eb.y+eb.vy if plyr.ift==0 and plyr.dat==0 and col(eb,eb.r*2,eb.r*2,plyr,6*plyr.xsc,3*plyr.ysc,-eb.r/1.5,-eb.r/1.5,2,-11) then plyr.ift=120 end if eb.y>136 or eb.y<-12 or eb.x<= -18 or eb.x>=258 then remove(ebuls,k) end circ(eb.x,eb.y,eb.r,1) end end function initPow(px,py,ptyp) local po={ x=px, y=py, typ=ptyp, } if ptyp==0 then --power po.vec={0,-4,-4,4,8,0,-4,4} po.vx=0 po.vy=0 end insert(pows,po) end function powUpdDrw() for k,p in pairs(pows) do local ang=atan2(plyr.x-p.x,plyr.y-p.y) if plyr.dt<1 then p.vx=sin(ang)*2 p.vy=cos(ang)*2 end if plyr.dt==0 and col(p,8,8,plyr,8*plyr.xsc,5*plyr.ysc,-4,- 4,0,-11) then plyr.pow=plyr.pow+10 sfx(0,"C-5",60,2) remove(pows,k) end if p.y>136 then remove(pows,k) end p.x=p.x+p.vx p.y=p.y+p.vy for i=0,16 do --fill (real) vector(p.x,p.y,p.vec,(mgt/4)%2+1,i/16,i/16) end end end function plyrUpdDrw() if plyr.ctrl==true then if btn(0) then plyr.vy=-plyr.spd elseif btn(1) then plyr.vy=plyr.spd else plyr.vy=0 end if btn(2) then plyr.vx=-plyr.spd elseif btn(3) then plyr.vx=plyr.spd else plyr.vx=0 end if btn(4) and plyr.ft==0 and mgt>=120 and plyr.dat==0 then plyr.ft=10 initBul(plyr.x+6,plyr.y-20,0,-3,2,8,0) end --a shield that costs 7 energy if btnp(5) and plyr.dat==0 and mgt>=120 and plyr.ift==0 then plyr.pow=plyr.pow-10 plyr.dat=90 end end plyr.x=plyr.x+plyr.vx plyr.y=plyr.y+plyr.vy if plyr.ctrl==true then if plyr.x<42 then plyr.x=42 elseif plyr.x>=190 then plyr.x=190 end if plyr.y<16 then plyr.y=16 elseif plyr.y>=119 then plyr.y=119 end end if plyr.ift>=1 then if plyr.ift%12==0 then plyr.pow=plyr.pow-1 end if plyr.ift==119 then sfx(1,"F#4",60,2,15,0) sfx(2,"F#4",120,3,6,2) end plyr.ift=plyr.ift-1 end if plyr.dat>0 then plyr.dat=plyr.dat-1 end if plyr.ft>=1 then circ(plyr.x+6,plyr.y-12,plyr.ft/2,1) plyr.ft=plyr.ft-1 end if mgt%30==0 and mgt>=120then plyr.pow=plyr.pow-1 end if plyr.pow>100 then plyr.pow=100 end if plyr.pow<=0 then plyr.dt=plyr.dt+1 plyr.ctrl=false plyr.show=false plyr.ift=0 end if mgt%4 ==0 and plyr.show==true then for i=1,5 do initPart(plyr.x+rnd(4,8),plyr.y+rnd(1,4),4,1,0.5,false,0,rnd(-2,2)/4,rnd(1,3)) end end if plyr.dat>0 then vector(plyr.x,plyr.y,plyr.ship,2+sin(mgt/2),plyr.xsc,plyr.ysc) circb(plyr.x+5,plyr.y-5,12,2) elseif plyr.ift==0 and plyr.show ==true then vector(plyr.x,plyr.y,plyr.ship,1,plyr.xsc,plyr.ysc) elseif plyr.ift>=1 and (2*sin(mgt))<0 and plyr.show ==true then vector(plyr.x,plyr.y,plyr.ship,1,plyr.xsc,plyr.ysc) end end function newWave() nwt=nwt+1 if wave%7==0 then print("BOSS!!! ",nwt*2,69,3) print("BOSS!!! ",nwt*2,68,1) elseif wave%7 ~=0 then print("WAVE " .. wave,nwt*2,69,3) print("WAVE " .. wave,nwt*2,68,1) end end function initPart(px,py,pr,pc,pdec,pang,pspd,pvx,pvy) ang=ang or false local pa={ x=px, y=py, r=pr, c=pc, dec=pdec, } if ang==false then pa.vx=pvx pa.vy=pvy elseif not ang==false then pa.vx=sin(ang)*pspd pa.vy=cos(ang)*pspd end insert(parts,pa) end function partUpdDrw() for k,p in pairs(parts) do p.x=p.x+p.vx p.y=p.y+p.vy p.r=p.r-p.dec if p.r<=0 then remove(parts,k) end circ(p.x,p.y,p.r-1,1) end end function invCirc(x,y,r,c) for i=x-r,x+r do for j=y-r,y+r do local sqrt=math.sqrt if (sqrt((x-i)^2+(y-j)^2))=30 then rect(9,15,20,36*(plyr.pow/100),1) elseif plyr.pow<30 then rect(9,15,20,36*(plyr.pow/100),2+sin(mgt/2)) end print("POWER",6,6,sin(mgt/4)+3) print("POWER",5,5,sin(mgt/4)+2) clip() print("WAVE " .. wave,41,123,3) print("WAVE " .. wave,41,122,1) print(score,41,130,3) print(score,41,129,1) line(40,120,208,120,1) if #boss > 0 then for k, b in pairs(boss) do print("BOSS",213,6,sin(mgt/4)+3) print("BOSS",212,5,sin(mgt/4)+2) rectb(212,16,24,40,1) rect(214,18,20,36*(b.hp/100),1) end end end function mainGame() cls(0) clip(40,0,166,120) if mgt<115 then newWave() plyr.y=exLerp(plyr.y,115,0.1) elseif mgt==116 then plyr.ctrl=true end if getTune()~=0 and plyr.pow>0 then music(0) end starUpdDrw() partUpdDrw() enemUpdDrw() bossUpdDrw() enemBulUpdDrw() bulUpdDrw() powUpdDrw() plyrUpdDrw() local wavTime={ 800,1500,2000,2800,3800,4600 --120,300,500,700,900,1100 } local wav=(wave%7) for i=1,#wavTime do if mgt==(wavTime[i]+mgtof) and plyr.dt==0 then wave=wave+1 nwt=0 end if mgt>=(wavTime[i]+mgtof) and mgt<(wavTime[i]+100+mgtof) and plyr.dt==0 then newWave() if wave%7==0 and mgt>120 then if mgt==wavTime[i] then initBoss(120,-48,0) for k,e in pairs(enems) do e.hp=0 end end end end end for k,s in pairs(stars) do local rndspd=rndspd or rnd(2,8)/4 s.vy=exLerp(s.vy,rndspd,0.05) end if wav==1 and mgt>120 then if mgt%60==0 then initEnem(42+(rnd(0,25)*6),-22,0,0,0,4,4) end elseif wav==2 then if mgt%60==0 then initEnem(42+(rnd(0,25)*6),-22,0,0,0,4,4) end if mgt%125==0 then initEnem(42+(rnd(0,25)*6),-22,0,0,1,5,5) end elseif wav==3 then if mgt%150==0 then for i=1,2 do initEnem(42+(rnd(0,25)*6),rnd(-18,-15),0,0,1,5,5) end end elseif wav==4 then if mgt%90==0 then for i=1,2 do initEnem(42+(rnd(0,25)*6),rnd(-18,-15),0,0,2,5,5) end end elseif wav==5 then if mgt%150==0 then initEnem(42+(rnd(0,25)*6),rnd(-18,-15),0,0,2,5,5) end if mgt%90==0 then initEnem(42+(rnd(0,25)*6),-22,0,0,0,4,4) end elseif wav==6 then if mgt%120==0 then initEnem(42+(rnd(0,25)*6),rnd(-18,-15),0,0,2,5,5) end if mgt%190==0 then for i=1,2 do initEnem(42+(rnd(0,25)*6),-22,0,0,1,5,5) end end end --HUD HUD() --[[if score==0 then print(score,2,8,1) else print(score .. "00",2,8,1) end]] mgt=mgt+1 if plyr.dt==1 then music() buls={} ebuls={} plyr.pow=0 if score>hscore then hscore=score end pmem(0,hscore) for i=0,15 do initPart(plyr.x+3,plyr.y-3,20+2*sin(i),0.25,1,false,1,2*cos(2*math.pi*i/16),2*sin(2*math.pi*i/16)) initPart(plyr.x+3,plyr.y-3,20+2*sin(i),0.1,1,false,1,cos(2*math.pi*i/16),sin(2*math.pi*i/16)) end end if plyr.dt>= 1 and plyr.dt<10 then sfx(4,"D-4",600,3) end if plyr.dt>=240 and plyr.dt<250 then for i=0,32638 do local x,y=i%240,i//240 if (x+y)%4==0 then poke4(i,0) end end elseif plyr.dt>=250 and plyr.dt<260 then for i=0,32638 do local x,y=i%240,i//240 if (x+y)%2==0 then poke4(i,0) end end elseif plyr.dt>=260 and plyr.dt<290 then cls() ebuls={} enems={} buls={} stars={} elseif plyr.dt>=290 then cls() gameState="joever" end end function initStar(sx,sy,sc,sr,aim,ang,spd,svx,svy,loop) aim=aim or false ang=ang or 0 local st={ x=sx, y=sy, c=sc, r=sr, lop=loop, } if aim==true then st.vx=sin(ang)*spd st.vy=cos(ang)*spd elseif aim==false then st.vx=svx st.vy=svy end insert(stars,st) end function starUpdDrw() for k,s in pairs(stars) do s.x=s.x+s.vx s.y=s.y+s.vy if s.lop==true and s.y>140 then s.y=rnd(-5,-3) elseif s.lop==true and s.x<-4 then s.x=rnd(244,248) end circ(s.x,s.y,s.r,s.c) end end function setPalMap(col) if col==nil then for i=0,15 do poke4(2*0x3ff0+i,i) end else for i=0,15 do poke4(2*0x3ff0+i,col) end end end tit=0 --TItle Timer for i=0,120 do initStar(rnd(0,240),rnd(0,136),rnd(2,3),rnd(0,1),false,0,0,0,0,true) end function titleScreen() cls(0) if tit<60 then clip(120-tit*3,68-tit*2,tit*6,tit*4) else clip() end if getTune()~=1 then music(1) end if btnp()~=0 then gameState="main" end starUpdDrw(0) setPalMap(3) map(30,0,30,17,2,2,0) setPalMap() map(30,0,30,17,0,0,0) local bspd=30 if tit%bspd>=(bspd/2) then print("Press Z to Start",80,91,3) print("Press Z to Start",80,90,1) end local hs=pmem(0) print("Highscore: "..hs,24,120,1) tit=tit+1 end --tune 0==main, c dorain function getTune() return peek(0x13ffc) end got=0 --game over time function gameOver() cls() print("You ran out of power...",16,24,1) if got>120 then waveTxt("Try again?",90,42,1,120,3,2) end if got>180 then print("Yes",60,80,2) print("Z",64,88,2) print("No",180,80,3) print("X",184,88,3) waveTxt("Score: " .. score,60,120,1,120,2 ,1) end if btnp(4) and got>=200 then INIT() for i=0,120 do initStar(rnd(0,240),rnd(0,136),rnd(2,3),rnd(0,1),false,0,0,0,0,true) end gameState="main" elseif btnp(5) and got>=200 then reset() end music() got=got+1 end function waveTxt(txt,x,y,c,spd,dep,xdep) xdep=xdep or 0 for i=1,#txt do let=string.sub(txt,i,i) print(let,x+i*6+xdep*cos(time()/120+i),y+dep*sin(time()/spd+i),c,false) end end cls() function intro() cls() if getTune() ~=1 then music(1,15,0,false) end gby=gby or 24 waveTxt("A game by",87,135-gby,3,120,-4,-2) waveTxt("A game by",88,136-gby,1,120,-4,-2) waveTxt("A game by",89,gby+1,3,120,4,2) waveTxt("A game by",88,gby,1,120,4,2) if int>=180 then gby=exLerp(gby,-16,0.05) tx1=tx1 or -118 tx2=tx2 or -96 tx3=tx3 or -72 tx4=tx4 or -48 tx5=tx5 or -32 tx6=tx6 or -16 ciR=ciR or 0 tx1=exLerp(tx1,63,0.07) -- S tx2=exLerp(tx2,83,0.08) -- R tx3=exLerp(tx3,103,0.09) -- B tx4=exLerp(tx4,123,0.1) -- 2 tx5=exLerp(tx5,143,0.11) -- E tx6=exLerp(tx6,163,0.12) -- R ciR=exLerp(ciR,60,0.1) spr(256,tx1,60,0,1,0,0,2,2) spr(258,tx2,60,0,1,0,0,2,2) spr(260,tx3,60,0,1,0,0,2,2) spr(262,tx4,60,0,1,0,0,2,2) spr(264,tx5,60,0,1,0,0,2,2) spr(258,tx6,60,0,1,0,0,2,2) circb(120,68,ciR,1) --circb(120,68,ciR-5,1) if int>=300 then rect(0,0,240,int*2-600,0) if int>=380 then music() tx1,tx2,tx3,tx4,tx5,tx6,ciR=nil,nil,nil,nil,nil,nil,nil gameState="title" end end end --gameState="title" int=int+1 end function loadPal(pal) for i=0,3 do local r=tonumber(string.sub(pal,i*6+1,i*6+2),16) local g=tonumber(string.sub(pal,i*6+3,i*6+4),16) local b=tonumber(string.sub(pal,i*6+5,i*6+6),16) poke(0x3FC0+(i*3)+0,r) poke(0x3FC0+(i*3)+1,g) poke(0x3FC0+(i*3)+2,b) end end function BDR(bdh) if plyr.dt>0 then end end function TIC() if gameState=="intro" then intro() elseif gameState=="title" then titleScreen() elseif gameState=="main" then mainGame() elseif gameState=="joever" then gameOver() end -- rectb(0,0,240,136,1) end