Skip to content

Instantly share code, notes, and snippets.

@Achie72
Created February 4, 2024 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Achie72/076859ce7fe17335fdb49ca7790d427b to your computer and use it in GitHub Desktop.
Save Achie72/076859ce7fe17335fdb49ca7790d427b to your computer and use it in GitHub Desktop.
1k Defender Raw Code
a,h,v,t,w,d,l,b,e,p,r,k,eb,ht,ld=20,64,100,0,0,0,10,{},{},{},rnd,del,{},{},0
function ce(a,b,c,d,e) if (((a-b)*(a-b)) + (c-d)*(c-d) <= e*e) then return true else return false end end
::_::
if time() < 3 then goto title else
cls()t+=1
if(t%2==1)add(b,{x=r(128),y=0,t=1,b=0,c=1+flr(r(2))*6})
if(t>30)then t,d=0,d+0.005 end
if(w<time())then
i={x=r(120),y=-2,t=r(3),s=r({1,2}),sp=time()+r()}add(e,i)
o=2-d
if(o<0.1)o=0.1
w=time()+(2-d)
end
if(btn(⬅️))h-=2
if(btn(➡️))h+=2
if(btn(⬆️))v-=2
if(btn(⬇️))v+=2
if(0<(h+6) and h<20 and v>99 and v<113)a+=1
if(btnp(❎)and(a>1))a=a-2add(b,{x=h,y=v,t=0,b=0,c=9})
for a in all(b) do
if a.b==0 then
m=a.t*4
if(a.t==0)m=-2
a.y+=m
if((a.y>128)or(a.y<0)) k(b,a)
end
tex=a.t==0 and "✽" or "."
?tex,a.x,a.y,a.c
end
for q in all(e) do
q.y,z,c=q.y+1,q.y,q.x
if q.s==1 and q.sp < time() then ebu={x=q.x,y=q.y+4,s=r()*2+1}add(eb,ebu) q.sp=time()+r()*4 end
te = q.s==1 and "☉" or "😐"
?te,q.x,q.y,8
if(z>128)k(e,q)l-=1
for a in all(b) do
p,o=a.x,a.y
if(a.t==0)and ce(p,q.x,o,q.y,3)then k(e,q)k(a,b)end
end
end
for b in all(eb) do
b.y+=b.s
if b.y > 128 then k(eb,b) end
if ce(h,b.x,v,b.y,3) then k(eb,b) l-=1 end
?"●",b.x-2,b.y-2,r({8,2})
end
if time()%15 == 0 then hr={x=r(128),y=0} add(ht,hr) end
for hr in all(ht) do
hr.y+=1
if ce(h,hr.x,v,hr.y,4) then k(ht,hr) l+=1 end
?"♥",hr.x-3,hr.y-3,rnd(15)
end
?"/ホ\\",h-7,v-2,11
?"⬆️"..flr(a/2),110,0,9
?"⬆️",2,100,9
?"♥"..l,0,0,11
if(t%5==1)?"◆",h-3,v+3,10
if(l<=0) then ld=time() end
flip()
if l>0 then goto _ else goto over end
end
::title::
cls()
?"1k defender",44,62,rnd({6,7})
flip()
goto _
::over::
?ld,64,64,11
@Achie72
Copy link
Author

Achie72 commented Feb 4, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment