`юлюллллллллллл ллл лллллллллю ю ю ю ю ю ю ю ю юллюлллллюллллллллллл лллллл ллллюлюлллллю люллллл люл лл ллл лю лллллюл юююллюллл л ю ллл лллллллллллллллллллллллллл ллл лллллллллллллллллллюллллюлюю ююлюлююллллю ю л л лл лл юю юллююллюллюю юл ллл лл юлюлллллл юлллю люлллл ллл юллллю лллюлллллл юлллл ю юлллл ллл юллллюл ю люлюллюлл юю лл лллю юююлюллюллюю ю лл ллл ю ю ююююлююю ю ю л ю л юллю ю ллюлллллюллллллллллл лллллл ллллллллллллллллллллллллл ллл лллллллллллллллллллюллллюлЪюююююю юлл юлл юллююл юююл юю ю ю ю юлл юююю юююю люююю ююю юю ююю юююююл юл юююююююллюююю юлл ю ю юл юююлюююю юююл юлююююл л юююю ююллюллю ю юююл ю ю юлл юллююл ююююл юл ююл ююююл юллю ю л ююююл ююююл л ююююллю юлююююю ю ю ю юллюлл ю ю ю л юю юююл юююююююлюю юллю юююююллюююююл юююююл юююююл л юююююююл юл юююююююююююл юллюююл юююллюллюююл юююллююююлююллюююююююллююююююл юююююл юююююююл ююю ююю ююю юююююююююллююю лююююююююююююююююю юююююлююююл ююююююююююл юл юююююл юююл юююююююююю лююл юююююл ююю ююл юююл юююл юллююююююююююююююююююл юююююююююю ююююююююююююю люююююю ю юююююююю юююююллю ю ююлллл ллллллл ю ю ююлллллллюллю ююллл ллл ллл ллл ллл ллл ллл ллл юл лл лю ю лю лююл юл л лю л лю люл юл лл лююл ллллллюл юл люлл лллюл ллюлюл юл ллллллюл люллюл юл л ллюл лллюлл люл юлюлллллю люллллл люл лл ллл лю лллллюл юлюллюлл юю лл лллю ююю юллююллюллюю юл ллл лл юлюлллллл юлллю люлллл ллл юллллю ллI1212121212ABABABABAB  12234567788:;;<<=>???????????? !" #$$ % '( ) *, -./////////////////0?1?2?456678899:;;<<<=>???????ck?л л л юл юллююл л л л юл юллююююююююююююююююююююююююююююююююююююююл ююююл юл юллююллл ююююл юл юююююююююююююююююююююююю ююююююююююю юл л л юююллююл л л л юююллл л л л л л юллюлл ююююююююююююю ю юююлюлюлюлюлюл юл ююлююююююююююююююююююю ююл юююю юю юю юю юю юю ююллюююю ююююююююююююю ююююююл л л л л л л л л ю ю ю ю ю ю ю ю ю ллллллллллллллллллюлл юлл юлл юлл юлл юлл юлл юлл юлл лю ллю ллю ллю ллю ллю ллю ллю ллю ллллллллллллллллллллллллллллллллллллл ю ю ю ю ю ю ю ю ююю юю юю юю юю юю юю юю юю юю юю юю юю юю юю юю юю ююю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ююлл ююлл ююлл ююлл ююлл ююлл ююлл ююлл ююлл юлю л юлю л юлю л юлю л юлю л юлю л юлю л юлю л юлю л юлллл юлллл юлллл юлллл юлллл юлллл юлллл юлллл юлллл ллллллллллллллллллллллллллллллллллллю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю юю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ююлл ююлл ююлл ююлл ююлл ююлл ююлл ююлл ююлл юлю л юлю л юлю л юлю л юлю л юлю л юлю л юлю л юлю л юлллл юлллл юлллл юлллл юлллл юлллл юлллл юлллл юлллл ллллллллллллллллллллллллллллллллллллю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю юллллллллллллллллллюлллл юлллл юлллл юлллл юлллл юлллл юлллл юлллл юлллл ллллллллллллллллллллллллллллллллллллллллллллллллллллллл ю юлл ю юлл ю юлл ю юлл ю юлл ю юлл ю юлл ю юлл ю юлллллллллллллллллллллллллллллллллллллллллллллллллллллллю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю лю ллю ллю ллю ллю ллю ллю ллю ллю лллллллллллллллллллю ю ллллллллллллллллллюлллл юлллл юлллл юлллл юлллл юлллл юлллл юлллл юлллл ллллллллллллллллллллллллллллллллллллллллллллллллллллллл ю юлл ю юлл ю юлл ю юлл ю юлл ю юлл ю юлл ю юлл ю юлллллллллллллллллллллллллллллллллллллллллллллллллллллллю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю ю лю ллю ллю ллю ллю ллю ллю ллю ллю лллллллллллллллллллллллллллллллллллллллюлллл юлллл юлллл юлллл юлллл ллллллллллллллллллллллллллллллюлллллл юлллллл юлллллл юлллллл юлллллл лллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллл юлллл юлллл юлллл юлллл юллллллллллллллллллллллл юлл юлл юлл юлл юлю ллюлллл ллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллллю ю ю ллллллюлллл юлллл юлллл лллллллллллллллллллллллллллллллллллллллллллллллллллллл"-- title: Space Invaders -- author: Lostcadesoft/BGelais -- desc: a remake of the original b/w arcade shooter -- version: 1.0 -- script: lua function TIC() game_init() go(Title) end function Title() wait(640,Table) score=0 lives=3 f=math.floor(tik/2%2) cls() hud() pstart() text("PLA",12,5) text("SPACE INVADERS",7,7) text("(C)1978 TAITO CORP.",4,11) text(" 2023 LOSTCADESOFT",4,12) text(" BY BGELAIS",4,13) if tik>0 and tik<120 then spr(345,120,39,0,1,2,0) spr(40+2*f,240-tik,40,0,1,0,0,2,1) elseif tik>=120 and tik<240 then spr(345,120+tik-124,39,0,1,2,0) spr(40+2*f,tik,40,0,1,0,0,2,1) elseif tik>=240 and tik<368 then spr(345,240-tik+248,40,0,1,0,0) spr(40+2*f,244-tik+248,40,0,1,0,0,2,1) elseif tik>=368 then spr(345,120,40,0,1,0,0) spr(40+2*f,120+tik-368,40,0,1,0,0,2,1) end end function Table() wait(640,Title) cls() hud() pstart() text("*SCORE TABLE*",8,5) text("pq=? MYSTERY",9,7) text("rs=30 POINTS",9,9) text("tu=20 POINTS",9,11) text("vw=10 POINTS",9,13) spr(9,240-tik,16,0,1,0,0,2,1) end function game_init() cls() rows={40,32,32,36,36} vaders={} vshots={} explodes={} shoot=false march=0 xd=1 speed=30 pl={x=120,y=120} shot={x=pl.x,y=120} ufo={} for y=0,16 do for x=0,29 do mset(x,y,mget(x+30,y)) end end for _y=1,5 do for _x=48,184,16 do vader={} vader.x=_x vader.y=16+_y*12 vader.s=rows[_y] if vader.s==40 then vader.p=30 end if vader.s==32 then vader.p=20 end if vader.s==36 then vader.p=10 end table.insert(vaders,vader) end end f=0 go(Game) end function Game() tik=tik+1 if tik%360==0 and not ufo.on then ufo_init() end if #vaders==0 then wait(120,game_init) end cls() map() hud() invaders() explodes_up() player() if shoot then shot_up() end end function Dead() tik=tik+1 if tik==1 then sfx(3) end if lives>0 and tik>180 then vshots={} pl.x=120 lives=lives-1 go(Game) end if lives<=0 and tik>180 then go(Over) end spr(11,pl.x-8,pl.y-4,-1,1,(tik/4)%2,0,2,1) end function Over() wait(200,Title) cls() hud() f=math.floor(tik/10) text(string.sub("GAME OVER",1,f),10,8) end function player() if btn(2) then pl.x=pl.x-1 elseif btn(3) then pl.x=pl.x+1 end if btnp(4) and not shoot then sfx(1,60,-1,1) shot={x=pl.x,y=pl.y} shoot=true end pl.x=math.min(pl.x,208) pl.x=math.max(pl.x,32) spr(1,pl.x-8,pl.y-4,0,1,0,0,2,1) end function shot_up() shot.y=shot.y-3 if mget(shot.x/8,(shot.y/8)-1)>48 then mset(shot.x/8,(shot.y/8)-1,48) shoot=false elseif mget(shot.x/8,(shot.y/8)-1)==48 then mset(shot.x/8,(shot.y/8)-1,0) shoot=false end if shot.y<16 then shoot=false end spr(3,shot.x-4,shot.y-4,0) end function invaders() vshots_up() if tik%(#vaders+1)==0 then march=march+1 march=march%30 if march<15 then xd=1 end if march>15 then xd=-1 end for id,o in pairs(vaders) do o.x=o.x+xd if march==0 or march==15 then o.y=o.y+2 end if math.random(50)==1 then vshoot(o) end sfx(0,10-o.x%3,5,0) end end for id,o in pairs(vaders) do if (col(o,shot) and shoot) or mapcol(o) then kill(o.x,o.y) score=score+o.p shoot=false table.remove(vaders,id) end spr(o.s+(o.x%2)*2,o.x-8,o.y-4,0,1,0,0,2,1) end if ufo.on then ufo.x=ufo.x-1 sfx(0,32+ufo.x%8,2,2,8) if ufo.x<-16 then ufo.on=false end if col(ufo,shot) and shoot then kill(ufo.x,ufo.y) score=score+ufo.p ufo.on=false end spr(9,ufo.x-8,ufo.y-4,0,1,0,0,2,1) end end function ufo_init() ufo={} ufo.x=256 ufo.y=20 ufo.on=true ufo.p=(#vaders+1)*50 end function vshoot(a) if #vshots<#vaders then table.insert(vshots,{x=a.x,y=a.y}) end end function vshots_up() for id,o in pairs(vshots) do o.y=o.y+1 if o.y>124 or mapcol(o) then table.remove(vshots,id) end if col(o,pl) then go(Dead) end spr(4+(tik/2)%2,o.x-4,o.y-4,0,1,0,0,1,1) end end function col(a,b) if math.abs(a.x-b.x)<8 and math.abs(a.y-b.y)<4 then return true end end function kill(_x,_y) sfx(2) table.insert(explodes,{x=_x,y=_y,t=15}) end function mapcol(a) xm=math.floor(a.x/8) ym=math.floor(a.y/8) if mget(xm,ym)>0 then return true end end function explodes_up() for id,e in pairs(explodes) do e.t=e.t-1 if e.t<=0 then table.remove(explodes,id) end spr(44,e.x-8,e.y-4,-1,1,0,0,2,1) end end function hud() text("SCORE",3,0) text("HI-SCORE",12,0) text(string.sub("0000"..score,-5),3,1) text(string.sub("0000"..pmem(0),-5),14,1) if score>pmem(0) then pmem(0,score) end if lives>0 then for i=1,lives do spr(1,8+16*i,128,-1,1,0,0,2,1) end end end function text(str,x,y) font(str,x*8,y*8,8,8,true,1) end function go(f) tik=0 TIC=f end function wait(s,f) tik=tik+1 if tik>s then tik=0 end if tik==s then go(f) end end function pstart() if tik%60<=30 then text("a/b START",11,16) end if btnp(4) or btnp(5) then game_init() go(Game) end end