|
Post by Carl Gundel on Nov 11, 2020 17:44:09 GMT -5
Is it even possible?
I dare you. I double dare you!
-Carl
|
|
|
Post by tsh73 on Nov 12, 2020 7:33:11 GMT -5
How about this for a start? the keys are
w a d
You can die under bomb. Or you can got crushed by landing UFO's. You can even fire Alas, as for now you cannot hit UFO - they are unvincible. Any takers?
open "" for graphics as #m c=15:y=300:x=y/2:e=6:r=50:u=y #m "font courier ";c;" ";c #m "down;trapclose [q];when characterInput [c]" timer 200, [t] wait
[t] #m "cls;place ";x;" ";y #m "\<|>" #m "place ";e;" ";r for i=1 to 5:#m "\A A A A A A A A":next e=e+5*(1-2*de):r=r+1 if (e<0)+(e>70) then de=1-de
if w>50 then #m "place ";q;" ";w:#m "\!":w=w-c
if (r+5*c>y) or ((u>=y) and (x-c<t) and (t<x+40)) then notice "DEAD!":end if u>=y then t=rnd(0)*15*c+e:u=r+5*c if u<y then #m "place ";t;" ";u:#m "\o":u=u+c wait
[c] c$=Inkey$ x = x-(c$="a")*c+(c$="d")*c if c$="w" then q=x+c:w=y-c wait
[q] close #m end
|
|
|
Post by tsh73 on Nov 12, 2020 7:41:42 GMT -5
Some variations on bit-coding the aliens (for now bits are random)
open "" for graphics as #m c=15:y=300:x=y/2:e=6:r=50:u=y #m "font courier ";c;" ";c #m "down;trapclose [q];when characterInput [c]" timer 300, [t] wait
[t] #m "cls;place ";x;" ";y #m "\<|>" #m "place ";e;" ";r for i=1 to 5:s=int(rnd(0)*256):s$="" for j = 0 to 7: if s and (2^j) then s$=s$+"A " else s$=s$+" " next:#m "\";s$:next
e=e+5*(1-2*de):r=r+1 if (e<0)+(e>70) then de=1-de
if w>50 then #m "place ";q;" ";w:#m "\!":w=w-c
if (r+5*c>y) or ((u>=y) and (x-c<t) and (t<x+40)) then notice "DEAD!":end if u>=y then t=rnd(0)*15*c+e:u=r+5*c if u<y then #m "place ";t;" ";u:#m "\o":u=u+c wait
[c] c$=Inkey$ x = x-(c$="a")*c+(c$="d")*c if c$="w" then q=x+c:w=y-c wait
[q] close #m end
|
|
|
Post by Carl Gundel on Nov 12, 2020 12:24:12 GMT -5
Some variations on bit-coding the aliens (for now bits are random) open "" for graphics as #m c=15:y=300:x=y/2:e=6:r=50:u=y #m "font courier ";c;" ";c #m "down;trapclose [q];when characterInput [c]" timer 300, [t] wait
[t] #m "cls;place ";x;" ";y #m "\<|>" #m "place ";e;" ";r for i=1 to 5:s=int(rnd(0)*256):s$="" for j = 0 to 7: if s and (2^j) then s$=s$+"A " else s$=s$+" " next:#m "\";s$:next
e=e+5*(1-2*de):r=r+1 if (e<0)+(e>70) then de=1-de
if w>50 then #m "place ";q;" ";w:#m "\!":w=w-c
if (r+5*c>y) or ((u>=y) and (x-c<t) and (t<x+40)) then notice "DEAD!":end if u>=y then t=rnd(0)*15*c+e:u=r+5*c if u<y then #m "place ";t;" ";u:#m "\o":u=u+c wait
[c] c$=Inkey$ x = x-(c$="a")*c+(c$="d")*c if c$="w" then q=x+c:w=y-c wait
[q] close #m end
Clever. 720 bytes. I dub thee Hack Invaders!
|
|
|
Post by Rod on Nov 12, 2020 13:28:04 GMT -5
720! There is room for setfocus then, stop me getting bombed before I get finger response 😀
|
|
|
Post by tsh73 on Nov 12, 2020 17:10:02 GMT -5
978 I kind of implemented firing part, now you can try and defend yourself (not sure if it is doable - after you fire rocket you cannot fire another one 'till it hits or vanish away. From watching Youtube I got an idea that it should behave this way) If you change
if c$="w" AND w=0 then q=x+c:w=y-c to
if c$="w" then q=x+c:w=y-c then next rocket will destroy flying one - allowing for faster fire rate (still they kill me every time - probably balance should be tweaked (say decrease descent rate, bomb speed)) One thing I did not checked is to see if I destroyed whole line of enemies. So you should not be crushed by line you destroyed.
Really if I not code it myself I would not believe it DOESN't actually aim to kill me with a bomb (really, pure random)
nomainwin:dim s(5):for i = 1 to 5:s(i)=255:next open "" for graphics as #m c=15:y=300:x=y/2:e=6:r=50:u=y #m "font courier_new ";c;" ";c #m "down;trapclose [q];when characterInput [c];setfocus" timer 500,[t] wait
[t] #m "cls;place ";x;" ";y #m "\<|>" #m "place ";e;" ";r for i=1 to 5:s$="":for j = 0 to 7:if s(i) and (2^j) then s$=s$+"A " else s$=s$+" " next:#m "\";s$:next
e=e+5*(1-2*de):r=r+1 if (e<0)+(e>70) then de=1-de
if w>0 then #m "place ";q;" ";w:#m "\!":w=w-c
ii=int((w-r)/c+2):jj=int((q-e+c)/c) if (ii>0) and (ii<6) and (jj>=0) and (jj<15) then if jj mod 2 =0 then if s(ii) and 2^int(jj/2) then s(ii)=s(ii) xor 2^int(jj/2):w=0 end if end if end if
if (r+5*c>y) or ((u>=y) and (x-c<t) and (t<x+40)) then notice "DEAD!":goto[q] if u>=y then t=rnd(0)*14*c+e:u=r+5*c if u<y then #m "place ";t;" ";u:#m "\o":u=u+c wait
[c] c$=Inkey$ x = x-(c$="a")*c+(c$="d")*c if c$="w" AND w=0 then q=x+c:w=y-c wait
[q] close #m end
|
|
|
Post by tsh73 on Nov 14, 2020 11:35:53 GMT -5
Now at 997 (with no CR LF at last line!) Changes: * adapted name "Hack Invaders" (thanks Carl for suggestion) * spent some time looking at YouTube Invaders, changed movement/speed * fine-tuned rocket collision (it might not look like it, but I fixed for 2 pixels by actually using screen ruler for vertical alignment) * made aliens different %) * added score * Now it is possible to WIN! Of course I hopelessly maimed program structure (indents and lines) in the process... EDIT pretty code with comments justbasiccom.proboards.com/thread/589/minimal-space-invadersThings doesn't fit in 1k (but could be added): * enemy should fire from remaining ships, not randomly from first line * if you get crashed by descending enemy - it really should check if there is a enemy ship there nomainwin:dim s(5):for i = 1 to 5:s(i)=255:next:open "Hack Invaders" for graphics_nsb_nf as #m c=15:y=300:x=y/2:e=6:r=50:u=y:#m "font courier_new ";c;" ";c #m "down;trapclose [q];when characterInput [c];setfocus":timer 100,[t]:wait [t] #m "cls;place 9 9 ;\\";k #m "place ";x;" ";y;";\<|>" #m "place ";e;" ";r for i=1 to 5:s$="":for j = 0 to 7:if s(i)and(2^j) then s$=s$+mid$("BASIC",i,1);" " else s$=s$+" " next:#m "\";s$:next e=e+(1-2*de):if (e<0)+(e>70) then de=1-de:r=r+5 if w>0 then #m "place ";q;" ";w:#m "\!":w=w-c o=int((w-r)/c+2):p=int((q-e+c+2)/c) if (o>0)and(o<6)and(p>=0)and(p<15) then if p mod 2=0 then a=2^(p/2):if s(o)and a then s(o)=s(o)xor a:w=0:k=k+1:if k=40 then notice "WIN!":goto[q] end if:end if:end if if(r+5*c>y)or((u>=y)and(x-10<t)and(t<x+40))then notice "DEAD!":goto[q] if u>=y then t=rnd(0)*14*c+e:u=r+5*c if u<y then #m "place ";t;" ";u:#m "\o":u=u+4 wait [c] c$=Inkey$:x=x-(c$="a")*5+(c$="d")*5 if c$="w" then q=x+c:w=y-c wait [q] close #m:end
|
|
|
Post by Carl Gundel on Nov 14, 2020 13:18:54 GMT -5
Now at 997 (with no CR LF at last line!) Changes: * adapted name "Hack Invaders" (thanks Carl for suggestion) * spent some time looking at YouTube Invaders, changed movement/speed * fine-tuned rocket collision (it might not look like it, but I fixed for 2 pixels by actually using screen ruler for vertical alignment) * made aliens different %) * added score * Now it is possible to WIN! Of course I hopelessly maimed program structure (indents and lines) in the process... EDIT pretty code with comments justbasiccom.proboards.com/thread/589/minimal-space-invadersThings doesn't fit in 1k (but could be added): * enemy should fire from remaining ships, not randomly from first line * if you get crashed by descending enemy - it really should check if there is a enemy ship there <code snipped> Nice work, seriously.
|
|
|
Post by Carl Gundel on Nov 14, 2020 13:20:23 GMT -5
Any other takers? I may try my hand at it, if I can find some cycles.
|
|