|
Post by Carl Gundel on Jun 9, 2021 11:13:14 GMT -5
I will give this a try, but I thought I would put it out there for others to try. -Carl
|
|
|
Post by tsh73 on Jun 9, 2021 16:42:14 GMT -5
Sorry Youtube says my browser too old, so just a link to MP4 video disk.yandex.ru/i/gxJf2eQaNJfa_gI got single alien and single rocket, in 1000 bytes (if I remove upper "UpperLeftX=1: UpperLeftY=1", added just to make video) And you lose if alien safely lands on the Earth. 25 longish lines, totally unreadable Now, is it possible to make ARRAY of aliens and/or ARRAY of rockets?
|
|
|
Post by Carl Gundel on Jun 10, 2021 10:21:52 GMT -5
Sorry Youtube says my browser too old, so just a link to MP4 video disk.yandex.ru/i/gxJf2eQaNJfa_gI got single alien and single rocket, in 1000 bytes (if I remove upper "UpperLeftX=1: UpperLeftY=1", added just to make video) And you lose if alien safely lands on the Earth. 25 longish lines, totally unreadable Now, is it possible to make ARRAY of aliens and/or ARRAY of rockets? NICE! Are you willing to share the code?
|
|
|
Post by tsh73 on Jun 10, 2021 15:02:27 GMT -5
Sure. I just want to see others to try, too
|
|
|
Post by Carl Gundel on Jun 10, 2021 16:20:48 GMT -5
Sure. I just want to see others to try, too Good point.
|
|
|
Post by tsh73 on Jun 12, 2021 14:36:33 GMT -5
As I said, 1000 bytes sharp. It counts your score, too. We have B+ posted code on another forum justbasiccom.proboards.com/thread/691/missile-commandAny more participants? nomainwin:open "StopEm" for graphics_nsb_nf as #g #g "trapclose 9;down;home;posxy cx cy;when mouseMove 0; when leftButtonUp 1" b$="size 1;color black":w$="size 2;color white" x0=cx:y0=2*cy:gosub 3:w=0:timer 30, 2:wait 0 x=MouseX:y=MouseY:wait 1 w=1:tx=x:ty=y:mx=x0:my=y0:d=d(tx,x0,ty,y0)/10:dx=(tx-x0)/d:dy=(ty-y0)/d:#g "place ";x-4;" ";y+6:#g "\X":wait 2 #g "place 5 5;\\";k:rx=rx+vx:ry=ry+vy:#g b$;";line ";r0;" 0";" ";rx;" ";ry if ry>2*cy then notice "You lost":goto 9 if w=0 then wait if w=1 then #g b$: mx=mx+dx:my=my+dy if d(mx,my,tx,ty)<11 then w=2:#g w$ #g "line ";x0;" ";y0;" ";mx;" ";my else #g "place ";tx;" ";ty:#g b$;";circlefilled ";r if d(rx,ry,tx,ty)<r then k=k+1:#g w$;";line ";r0;" 0";" ";rx;" ";ry;";";b$: gosub 3 if r>20 then #g w$;";circlefilled ";r;";";b$:r=0:w=0 r=r+2 end if wait 3 rx=2*cx*rnd(0):ry=0:r0=rx:qx=2*cx*rnd(0):qy=y0:d=d(rx,ry,qx,qy)/2:vx=(qx-rx)/d:vy=(qy-ry)/d: return 9 close #g:end function d(x,y,a,b) d=sqr((x-a)^2+(y-b)^2) end function
|
|
|
Post by Carl Gundel on Jun 15, 2021 10:10:05 GMT -5
I am planning to present something also.
|
|
|
Post by tsh73 on Jun 16, 2021 7:50:31 GMT -5
1076 1058 1019 999 bytes. Do you know how much space I need to save? "I need this space!."I did it. Now, such code brought BASIC it's bad reputation Impossible to read. All strings glued into longish ones as possible. All variables ^H to random single letter. There was "win" condition - removed for size. Now if you live long enough for array to end (Subscript out of range: 26, r())- consider yourself won (Now I cannot replicate this on touchpad)(Could be done with a mouse) Trapclose - removed for size (jumps to missing label if game is lost) BUT now you indeed have array of enemy rockets, and you can wipe several enemies with your rocket. nomainwin:open "" for graphics as #g:#g "down;home;posxy X Y;when mouseMove 0; when leftButtonUp 1":b$="size 1;color black":w$="size 2;color white":c$=";circlefilled ":dim r(25,6):z=2*Y:w=0:timer 30,4:wait 4 if A<5 and rnd(0)<.05 then I=I+1:A=A+1:r(I,0)=1:R=2*X*rnd(0):r(I,1)=R:r(I,3)=R:Q=2*X*rnd(0):d=d(r,0,Q,z):r(I,5)=(Q-R)/d:r(I,6)=z/d #g b$:for i=1 to I:if r(i,0)=0 then 8 r(i,3)=r(i,3)+r(i,5):r(i,4)=r(i,4)+r(i,6):gosub 6:if r(i,4)>z then 9 8 next if w=0 then wait if w=1 then M=M+D:N=N+E:if d(M,N,T,S)<11 then w=2:#g w$ #g "line ";X;" ";z;" ";M;" ";N else #g b$;";place ";T;" ";S;c$;r:for i = 1 to I:if r(i,0)=0 then 7 if d(r(i,3),r(i,4),T,S)<r then #g w$:gosub 6:r(i,0)=0:A=A-1:#g b$ 7 next r=r+2:if r>20 then #g w$;c$;r;";";b$:r=0:w=0 end if:wait 6 #g "line ";r(i,1);" 0 ";r(i,3);" ";r(i,4):return 0 x=MouseX:y=MouseY:wait 1 w=1:T=x:S=y:M=X:N=z:d=d(T,X,S,z)/10:D=(T-X)/d:E=(S-z)/d:#g "place ";x-4;" ";y+6;";\X":wait function d(x,y,a,b) d=sqr((x-a)^2+(y-b)^2) end function Interesting(?) bit. There are two CONTINUE statements in this code, THEN [GOTO] 7 and THEN [GOTO] 8
|
|
|
Post by Carl Gundel on Jun 16, 2021 8:53:46 GMT -5
1076 1058 1019 999 bytes. Do you know how much space I need to save? "I need this space!."I did it. Now, such code brought BASIC it's bad reputation Impossible to read. Yeah, looks like old VIC-20 code or similar. See that line numbers are useful for something (saving memory in this case). Get rid of nomainwin to save even more.
|
|
|
Post by tsh73 on Jun 16, 2021 8:56:15 GMT -5
If LB supported X=some_calculation goto X
it would be even more useful
|
|
|
Post by tsh73 on Jun 16, 2021 9:01:00 GMT -5
There not much one could put in 10 bytes. If I could put trapclose back under 1000 bytes I would get rid of nomainwin. Now it just doesn't fit, so no point.
|
|
|
Post by Carl Gundel on Jun 16, 2021 9:20:16 GMT -5
There not much one could put in 10 bytes. If I could put trapclose back under 1000 bytes I would get rid of nomainwin. Now it just doesn't fit, so no point. Why do you need the :wait at the end of the first line?
|
|
|
Post by tsh73 on Jun 16, 2021 12:58:25 GMT -5
Thanks. I reimplemented label 9 so now program normally ends on "lose" outcome (got reports that it crashed with whole BASIC)
open "" for graphics as #g:#g "down;home;posxy X Y;when mouseMove 0; when leftButtonUp 1":b$="size 1;color black":w$="size 2;color white":c$=";circlefilled ":dim r(25,6):z=2*Y:w=0:timer 30,4 4 if A<5 and rnd(0)<.05 then I=I+1:A=A+1:r(I,0)=1:R=2*X*rnd(0):r(I,1)=R:r(I,3)=R:Q=2*X*rnd(0):d=d(r,0,Q,z):r(I,5)=(Q-R)/d:r(I,6)=z/d #g b$:for i=1 to I:if r(i,0)=0 then 8 r(i,3)=r(i,3)+r(i,5):r(i,4)=r(i,4)+r(i,6):gosub 6:if r(i,4)>z then 9 8 next if w=0 then wait if w=1 then M=M+D:N=N+E:if d(M,N,T,S)<11 then w=2:#g w$ #g "line ";X;" ";z;" ";M;" ";N else #g b$;";place ";T;" ";S;c$;r:for i = 1 to I:if r(i,0)=0 then 7 if d(r(i,3),r(i,4),T,S)<r then #g w$:gosub 6:r(i,0)=0:A=A-1:#g b$ 7 next r=r+2:if r>20 then #g w$;c$;r;";";b$:r=0:w=0 end if:wait 6 #g "line ";r(i,1);" 0 ";r(i,3);" ";r(i,4):return 0 x=MouseX:y=MouseY:wait 1 w=1:T=x:S=y:M=X:N=z:d=d(T,X,S,z)/10:D=(T-X)/d:E=(S-z)/d:#g "place ";x-4;" ";y+6;";\X":wait 9 close #g:end function d(x,y,a,b) d=sqr((x-a)^2+(y-b)^2) end function
|
|