0,]']>SցyHYq(0H)6o;]AsVl3?O???O??O???O???O???? ADlHIIFKEL4N"OOOOOOOOOOOOOOOOOOOOOOOs  * PQSVWWXXYZ[\\]^^______________   OpKSIGG9FEDCBBCCDEFGHJLMNOOOOOOOOO7N  Dd `   Dd `  2(?@DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD@3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333@""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""@""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""@""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""@DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD !31<!<!3< 2# !32#! 2#<<< 2#<2#!<2#!31!31 !<2# 2#!< !312#1<!< <2# 2#!3  !32#< <2#2#!3!< 1 1!<!32#2#2#!3<!<2#<1!3<2#12#<!32#!<<2#!<2#<2#!312#!!<1!3<1!3!<2#12#2#!<2#!<< 1!<2#<1#1#2#!<<1<!32#!<!32#2#!<<<!2#2#<22#<!32#< 1#!<2#2# !<1!3!< 11!311!<2#1 !<2#!3<!< !2#<!2#2#! !3<1#1!<!32#2#=p.x-w and b.x<=p.x+w and b.y>=p.y-w and b.y<=p.y+w and p.died==false then p.health=p.health-1 if p.health==0 then p.died=true end sfx(0) for i=0,5 do add_hitpars(b.x,b.y,rand(-50, 50)/50,rand(-50, 50)/50,2,5) end table.remove(boss_bullets, k) end spr(b.spri, b.x, b.y, 0) if b.t > 200 then table.remove(boss_bullets, k) end end end function add_player_bullet() local b={} b.t=0 b.x=p.x b.y=p.y b.spri=18 table.insert(player_bullets, b) end function update_player_bullets() for k,b in pairs(player_bullets) do b.t = b.t + 1 --p.dy = p.dy + 0.1 b.x = b.x + 5 w=8 if b.x>=boss.x-w and b.x<=boss.x+w and b.y>=(boss.y+12)-w and b.y<=(boss.y+16)+w and boss.died==false then boss.health=boss.health-1 table.remove(player_bullets, k) shake = 10 if boss.health==0 then boss.died=true return end sfx(1,30,10,1,15) for i=0,5 do add_hitpars(b.x,b.y,rand(-100, 100)/50,rand(-100, 100)/50,11,3) end end spr(b.spri, b.x, b.y, 0) if b.t > 150 then table.remove(player_bullets, k) end end end function add_hitpars(x,y,vx,vy,c,s) local p={} p.x=x p.y=y p.vx=vx p.vy=vy p.c=c p.s=s p.t=0 table.insert(hit_pars, p) end function update_hitpars() for k,p in pairs(hit_pars) do p.t = p.t + 1 p.y = p.y + p.vy p.x = p.x + p.vx p.s=p.s-0.1 circ(p.x, p.y, p.s, p.c) circb(p.x,p.y,p.s,p.c+1) if p.t > 40 then table.remove(hit_pars, k) end end end function add_spacepar() local p={} p.x=245 p.y=rand(0, 136) p.dx=rand(-100.0,-50.0)/50.0 p.t=0 table.insert(space_pars, p) end function update_spacepars() for k,p in pairs(space_pars) do p.t = p.t + 1 --p.dy = p.dy + 0.1 p.x = p.x + p.dx pix(p.x, p.y, 12) if p.t > 150 then table.remove(space_pars, k) end end end --music(0,0) function game() if p.died==false then if btn(0) then p.vy=-1 elseif btn(1) then p.vy=1 else p.vy=0 end if btn(2) then p.vx=-1 elseif btn(3) then p.vx=1 else p.vx=0 end end normalize(p.vx,p.vy) p.x=p.x+p.vx p.y=p.y+p.vy if p.x<=0 then p.x=0 elseif p.x>=232 then p.x=232 end if p.y<=0 then p.y=0 elseif p.y>=128 then p.y=128 end if p.vy==-1 then p.spri=1 elseif p.vy==1 then p.spri=33 else p.spri=17 end add_spacepar() if btn(4) and tb%8==0 then add_player_bullet() sfx(2,20,-1,3) end if p.health==0 then for i=0,20 do add_hitpars(p.x+4, p.y+4, rand(-100,100)/50.0,rand(-100,100)/50.0,10,4) end sfx(0,-1,-1,0,15,-3) p.health=-1 end --boss.pattren=4 --PATTRENs --boss start if boss.pattren==-2 then boss.x=lerp(boss.x,190,0.2) boss.y=lerp(boss.y,136/2-8,0.2) if tb>80 then boss.pattren=rand(0,4) end end --boss died if boss.health==0 then for i=0,20 do add_hitpars(boss.x+16, boss.y+16, rand(-50,50)/50.0,rand(-50,50)/50.0,2,6) end sfx(1,-1,-1,0,15,-3) boss.health=-1 end --0 if boss.pattren==0 then boss.x=boss.x+math.cos(t) boss.y=boss.y+math.sin(t) add_boss_bullet(boss.x-6,boss.y+16,rand(-7, -2)/5, rand(-10, 10)/5) end --1 if boss.pattren==1 then boss.x=190 boss.y=136/2-8 add_boss_bullet(boss.x-6,boss.y+16,math.sin(tb), math.cos(tb)) end --2 if boss.pattren==2 then boss.y=boss.y+math.cos(t/3) if tb%10==0 then add_boss_bullet(boss.x-6,boss.y+16,-2,math.sin(t)) add_boss_bullet(boss.x-6,boss.y+25,-2,math.cos(t)) end end --3 if boss.pattren==3 then if tb%10==0 then wvx=p.x-boss.x wvy=p.y-boss.y-16 w=math.sqrt(wvx^2+wvy^2) wvx=wvx/w*2 wvy=wvy/w*2 if rand(0,1)==1 then add_boss_bullet(boss.x-6,boss.y+16,wvx,wvy-0.5) add_boss_bullet(boss.x-6,boss.y+16,wvx,wvy) add_boss_bullet(boss.x-6,boss.y+16,wvx,wvy+0.5) end end end cls(0) --4 if boss.pattren==4 then if tb%20==0 then for k,pos in pairs(pattren4poses) do wvx=p.x-pos.x wvy=p.y-pos.y w=math.sqrt(wvx^2+wvy^2) wvx=wvx/w*2 wvy=wvy/w*2 if rand(0,2)==1 then add_boss_bullet(pos.x, pos.y, wvx/2, wvy/2) end end end end if boss.died==false then if tb%400==300 then boss.p_pattren=boss.pattren boss.pattren=-1 end if boss.pattren==-1 then boss.x=lerp(boss.x,190,0.1) boss.y=lerp(boss.y,136/2-8,0.1) end if tb%400==0 and boss.pattren ~= -2 then local n=rand(0,4) while(n==boss.p_pattren) do n=rand(0,4) end boss.pattren=n end else boss.pattren=-3 end if shake>0 then poke(0x3FF9,math.random(-d,d)) poke(0x3FF9+1,math.random(-d,d)) shake=shake-1 if shake==0 then memset(0x3FF9,0,2) end end update_spacepars() update_player_bullets() update_boss_bullets() update_hitpars() --boss par rect(2,2,boss.health,5,2) rect(2,2,boss.health,1,3) rectb(1,1,202,6,4) --player par rect(2,130,p.health*5,5,10) rect(2,130,p.health*5,1,11) rectb(2,129,26,6,4) if p.died==false then spr(p.spri,p.x,p.y,0,1) end if boss.died==false then spr(boss.spri,boss.x, boss.y,0,2,0,0,2,2) end --print(boss.pattren,84,84,12) --print(boss.p_pattren,99,84,12) t=t+0.1 tb=tb+1 if p.died==true then tply=tply+1 end if boss.died==true then tbos=tbos+1 end if boss.died==true and tbos>=250-136 then trans=trans+1 rect(0,trans,240,136,0) end if tply>=80 then game_mode=0 end if tbos>=250 then game_mode=2 end end function reset_stats() p.health=5 p.x=10 p.y=136/2 p.died=false boss.health=200 boss.x=300 boss.y=136/2-8 boss.pattren=-2 boss.died=false tply=0; tbos=0 tb=0 ; t=0 trans=-136 end function main_menu() if tm%10==0 then if btncolor==14 then btncolor=13 elseif btncolor==13 then btncolor=14 end end if btn(4) or btn(5) or btn(6) or btn(7) then reset_stats() game_mode = 1 end cls(0) spr(10,240/2-38, 136/2+29+math.sin(tm/6)) spr(64,240//2-35,136//2-40+math.cos(tm/6),-1,1,0,0,16,16) --line(240/2,0, 240/2,136,12) print("Start Game", 240/2-30, 136/2+30+math.sin(tm/6), btncolor) tm=tm+1 end function win_menu() cls(0) --line(240/2,0, 240/2,136,12) print('Thanks for Playing \n hope you enjoyed',240/2-50, 136/2-30+math.sin(t),12,true) print('Press Up to restart',240/2-50, 136/2+20+math.sin(t),13,true) t=t+0.1 if btnp(0) then game_mode=0 end end ti=0 sprf=17 ipy=60 ily=20 function icon_image() cls(0) if ti%60== 0 then sprf=1 end if ti%60==15 then sprf=17 end if ti%60==30 then sprf=33 end if ti%60==45 then sprf=17 end add_hitpars(40,ipy+20, rand(-80,-50)/50.0,rand(-50,50)/50.0,9,5) add_spacepar() ipy=ipy+math.sin(ti/10) ily=ily+math.cos(ti/10) update_hitpars() update_spacepars() spr(sprf, 47, ipy,0,6) spr(64,240//2-25,ily,0,2,0,0,16,16) --print(ti%30) ti=ti+1 end function TIC() if game_mode==1 then game() elseif game_mode==0 then main_menu() elseif game_mode==2 then win_menu() elseif game_mode==3 then icon_image() end end