ÎÌÌÌ̈ˆˆ¬ªªª¬ˆˆˆ¬ÌÌ̬ÌÀ̬ÌÀ̬ÌÀÌÌÌìÌÀÀî̬ÀÌÀ¬ÀÀÀ¬ÀÀÀ¬ÀÀÎÌÌÌ̈ˆˆ¬ªªª¬ˆˆˆ¬ÌÌ̬ÌÌ̬ÌÀ̬ÌÀÌÌÌìÌÀÀî̬ÀÌ̬ÀÀÀ¬ÀÀÀ¬ÀÀ¬ÌÌ̬ªªª¬ª¬ª¬ªÊ̬ªªªŒˆˆˆÌÀÌÎÌÌÎ̬̪ªÀ쬪ÀÀÀÌîÀìîÌÌîî¬ÌÌ̬ªªª¬ª¬ª¬ªÊ̬ªªªŒˆˆˆÌÀÌÎÌÌÎ̬̪ªÀ쬪ÀÀÀÌîÀìîÌÌîî >O/ÌÌÀ ÀÌÀÌÌÌÌ ÀÌ Ì À ÌÀ Ì ÀÌÀ ÀÀ ÀÀ ÌÌ ÀÌÀÌÀ ÀÀ ÀÌÀ Ì ÀÌ ÌÌÌ À Ì À ÀÌ ÀÌ @@DDDDDDD@f`fffffffffff`fff -- title: shoot the green balls -- author: yep! still me -- desc :press z to shoot --script: lua w=240 h=136 cx=w/2 cy=h/2 sin=math.sin cos=math.cos pi=math.pi rand=math.random sqrt=math.sqrt vector={} vector.__index=vector function vector:new() return setmetatable({},vector) end function vector:add(x,y,pos,speed,r) table.insert(self,{x=x, y=y, p=pos, s=speed, r=r}) end bullets=vector:new() enemies=vector:new() score=0 pos=0 orbitR=6 shipSize=4 v=0.1 dis=4.5 dead=false function move(dir) pos = pos + (dir * v) if pos > 2*pi then pos = 0 elseif pos < 0 then pos = 2*pi end end function spawn_enemy() local side = rand(1, 4) local ex, ey local margin = 10 if side == 1 then ex = rand(0, w) ey = -margin elseif side == 2 then ex = rand(0, w) ey = h + margin elseif side == 3 then ex = -margin ey = rand(0, h) else ex = w + margin ey = rand(0, h) end enemies:add(ex, ey, 0, 0.5, 3) end function TIC() if dead then cls(0) print("GAME OVER!", 90, 60, 12) print("Score: "..score, 90, 70, 12) print("Press CTRL+R to restart", 60, 90, 15) return end cls(0) print("Score: "..score, 5, 5, 12) if btn(2) then move(-1) end if btn(3) then move(1) end nx=cx+cos(pos)*orbitR ny=cy+sin(pos)*orbitR x1=nx+cos(pos)*shipSize y1=ny+sin(pos)*shipSize x2=nx+cos(pos+dis)*shipSize y2=ny+sin(pos+dis)*shipSize x3=nx+cos(pos-dis)*shipSize y3=ny+sin(pos-dis)*shipSize if btnp(4) then bullets:add(x1, y1, pos, 2, 1) end if rand(1,100) == 67 then spawn_enemy() end circ(cx, cy, 1, 12) tri(x1, y1, x2, y2, x3, y3, 4) for i=#bullets, 1, -1 do local b=bullets[i] b.x = b.x + cos(b.p) * b.s b.y = b.y + sin(b.p) * b.s circ(b.x, b.y, b.r, 4) if b.x < 0 or b.x > w or b.y < 0 or b.y > h then table.remove(bullets, i) else for j=#enemies, 1, -1 do local e = enemies[j] if math.abs(b.x - e.x) < 4 and math.abs(b.y - e.y) < 4 then table.remove(enemies, j) table.remove(bullets, i) score=score+100 break end end end end for i=#enemies, 1, -1 do local e = enemies[i] local dx = cx - e.x local dy = cy - e.y local dist = sqrt(dx*dx + dy*dy) if dist < 2 then dead = true end if dist > 1 then e.x = e.x + (dx / dist) * e.s e.y = e.y + (dy / dist) * e.s end circ(e.x, e.y, e.r, 6) end end