Home » Archimedes archive » Acorn User » AU 1998-08.adf » Regulars » StarInfo/Brobecker/BoingShip
StarInfo/Brobecker/BoingShip
This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.
Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.
Tape/disk: | Home » Archimedes archive » Acorn User » AU 1998-08.adf » Regulars |
Filename: | StarInfo/Brobecker/BoingShip |
Read OK: | ✔ |
File size: | 07C7 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
10REM>>> Ship constituted of springs 20REM Alain BROBECKER (baah/Arm's Tech) on ??-???-1997 30MODE9:OFF 40READn :REMnb of brows 50READo :REMnb of edges 60DIMx(n),y(n),vx(n),vy(n),ax(n),ay(n) :REMcoords 70FORc=1TOn:READx,y:x(c)=x+160:y(c)=y+128:NEXT 80vx()=0:vy()=0 90DIMs%(o),e%(o),l(o) :REMedges lookup and length 100FORc=1TOo:READs%(c),e%(c):NEXT 110FORc=1TOo:l(c)=SQR((x(s%(c))-x(e%(c)))^2+(y(s%(c))-y(e%(c)))^2):NEXT 120k=0.25 :REMsprings' stiffness 130a=.96 :REMabsorption 140g=.1 :REMgravity 150 160b%=1 :REMscreenbank 170REPEAT 180 REMcalculate isobarycenter coords 190 x=0:y=0:FORc=1TOn:x+=x(c):y+=y(c):NEXT:x=x/n:y=y/n 200 REMwhen player accelerate, we put this acceleration along the 210 REMisobarycenter/1st brow axis. 220 IFINKEY(NOT57)THEN 230 dx=x(1)-x:dy=y(1)-y 240 d=SQR(dx^2+dy^2) 250 IFd<>0THENnx=dx/d:ny=dy/d 260 FORc=1TOn:ax(c)=nx/4:ay(c)=g+ny/4:NEXT 270 ELSE 280 ax()=0:ay()=g 290 ENDIF 300 REMwhen player rotates, we add to each brow an acceleration perpendicular 310 REMto the isobarycenter/brow axis. 320 IFINKEY(NOT25)THEN 330 FORc=1TOn 340 dx=x(c)-x:dy=y(c)-y 350 d=SQR(dx^2+dy^2):nx=dx/d:ny=dy/d 360 ax(c)+=ny/8:ay(c)-=nx/8 370 NEXT 380 ENDIF 390 IFINKEY(NOT121)THEN 400 FORc=1TOn 410 dx=x(c)-x:dy=y(c)-y 420 d=SQR(dx^2+dy^2):nx=dx/d:ny=dy/d 430 ax(c)-=ny/8:ay(c)+=nx/8 440 NEXT 450 ENDIF 460 WAIT:SYS"OS_Byte",&71,b%:b%=b%EOR3:SYS"OS_Byte",&70,b%:CLS 470 REMCompute force for each spring 480 FORc=1TOo 490 dx=x(s%(c))-x(e%(c)) 500 dy=y(s%(c))-y(e%(c)) 510 l=SQR(dx^2+dy^2) 520 ax=(l(c)-l)*k*dx/l 530 ay=(l(c)-l)*k*dy/l 540 ax(s%(c))+=ax:ax(e%(c))-=ax 550 ay(s%(c))+=ay:ay(e%(c))-=ay 560 NEXT 570 REMcompute movements for each point 580 FORc=1TOn 590 vx(c)=vx(c)*a+ax(c) 600 vy(c)=vy(c)*a+ay(c) 610 x(c)+=vx(c) 620 y(c)+=vy(c) 630 IFx(c)<0THENx(c)=0:vx(c)=-vx(c) 640 IFy(c)<0THENy(c)=0:vy(c)=-vy(c) 650 IFx(c)>319THENx(c)=319:vx(c)=-vx(c) 660 IFy(c)>255THENy(c)=255:vy(c)=-vy(c) 670 NEXT 680 FORc=1TOo:LINEx(s%(c))<<2,255-y(s%(c))<<2,x(e%(c))<<2,255-y(e%(c))<<2:NEXT 690UNTILFALSE 700END 710 720REMnb_coords & nb_edges 730DATA3,3 740REMcoords 750DATA 0,30, -15,-15, 15,-15 760REMedges 770DATA 1,2, 1,3, 2,3
$�>>> Ship constituted of springs 9� Alain BROBECKER (baah/Arm's Tech) on ??-???-1997 �9:� (�n :�nb of brows 2�o :�nb of edges </�x(n),y(n),vx(n),vy(n),ax(n),ay(n) :�coords F'�c=1�n:�x,y:x(c)=x+160:y(c)=y+128:� Pvx()=0:vy()=0 Z/�s%(o),e%(o),l(o) :�edges lookup and length d�c=1�o:�s%(c),e%(c):� n@�c=1�o:l(c)=�((x(s%(c))-x(e%(c)))^2+(y(s%(c))-y(e%(c)))^2):� x$k=0.25 :�springs' stiffness �a=.96 :�absorption �g=.1 :�gravity � �b%=1 :�screenbank �� �$ �calculate isobarycenter coords �1 x=0:y=0:�c=1�n:x+=x(c):y+=y(c):�:x=x/n:y=y/n �@ �when player accelerate, we put this acceleration along the �" �isobarycenter/1st brow axis. � �(�57)� � dx=x(1)-x:dy=y(1)-y � d=�(dx^2+dy^2) � �d<>0�nx=dx/d:ny=dy/d & �c=1�n:ax(c)=nx/4:ay(c)=g+ny/4:� � ax()=0:ay()=g " � ,L �when player rotates, we add to each brow an acceleration perpendicular 6% �to the isobarycenter/brow axis. @ �(�25)� J �c=1�n T dx=x(c)-x:dy=y(c)-y ^% d=�(dx^2+dy^2):nx=dx/d:ny=dy/d h ax(c)+=ny/8:ay(c)-=nx/8 r � | � � �(�121)� � �c=1�n � dx=x(c)-x:dy=y(c)-y �% d=�(dx^2+dy^2):nx=dx/d:ny=dy/d � ax(c)-=ny/8:ay(c)+=nx/8 � � � � �7 Ȗ:ș"OS_Byte",&71,b%:b%=b%�3:ș"OS_Byte",&70,b%:� �$ �Compute force for each spring � �c=1�o � dx=x(s%(c))-x(e%(c)) � dy=y(s%(c))-y(e%(c)) � l=�(dx^2+dy^2) ax=(l(c)-l)*k*dx/l ay=(l(c)-l)*k*dy/l ! ax(s%(c))+=ax:ax(e%(c))-=ax &! ay(s%(c))+=ay:ay(e%(c))-=ay 0 � :& �compute movements for each point D �c=1�n N vx(c)=vx(c)*a+ax(c) X vy(c)=vy(c)*a+ay(c) b x(c)+=vx(c) l y(c)+=vy(c) v! �x(c)<0�x(c)=0:vx(c)=-vx(c) �! �y(c)<0�y(c)=0:vy(c)=-vy(c) �% �x(c)>319�x(c)=319:vx(c)=-vx(c) �% �y(c)>255�y(c)=255:vy(c)=-vy(c) � � �F �c=1�o:�x(s%(c))<<2,255-y(s%(c))<<2,x(e%(c))<<2,255-y(e%(c))<<2:� ��� �� � ��nb_coords & nb_edges ��3,3 ��coords �� 0,30, -15,-15, 15,-15 � �edges � 1,2, 1,3, 2,3 �
00000000 0d 00 0a 24 f4 3e 3e 3e 20 53 68 69 70 20 63 6f |...$.>>> Ship co| 00000010 6e 73 74 69 74 75 74 65 64 20 6f 66 20 73 70 72 |nstituted of spr| 00000020 69 6e 67 73 0d 00 14 39 f4 20 20 20 20 41 6c 61 |ings...9. Ala| 00000030 69 6e 20 42 52 4f 42 45 43 4b 45 52 20 28 62 61 |in BROBECKER (ba| 00000040 61 68 2f 41 72 6d 27 73 20 54 65 63 68 29 20 6f |ah/Arm's Tech) o| 00000050 6e 20 3f 3f 2d 3f 3f 3f 2d 31 39 39 37 0d 00 1e |n ??-???-1997...| 00000060 08 eb 39 3a 87 0d 00 28 1a f3 6e 20 20 20 20 20 |..9:...(..n | 00000070 20 20 3a f4 6e 62 20 6f 66 20 62 72 6f 77 73 0d | :.nb of brows.| 00000080 00 32 1a f3 6f 20 20 20 20 20 20 20 3a f4 6e 62 |.2..o :.nb| 00000090 20 6f 66 20 65 64 67 65 73 0d 00 3c 2f de 78 28 | of edges..</.x(| 000000a0 6e 29 2c 79 28 6e 29 2c 76 78 28 6e 29 2c 76 79 |n),y(n),vx(n),vy| 000000b0 28 6e 29 2c 61 78 28 6e 29 2c 61 79 28 6e 29 20 |(n),ax(n),ay(n) | 000000c0 3a f4 63 6f 6f 72 64 73 0d 00 46 27 e3 63 3d 31 |:.coords..F'.c=1| 000000d0 b8 6e 3a f3 78 2c 79 3a 78 28 63 29 3d 78 2b 31 |.n:.x,y:x(c)=x+1| 000000e0 36 30 3a 79 28 63 29 3d 79 2b 31 32 38 3a ed 0d |60:y(c)=y+128:..| 000000f0 00 50 11 76 78 28 29 3d 30 3a 76 79 28 29 3d 30 |.P.vx()=0:vy()=0| 00000100 0d 00 5a 2f de 73 25 28 6f 29 2c 65 25 28 6f 29 |..Z/.s%(o),e%(o)| 00000110 2c 6c 28 6f 29 20 3a f4 65 64 67 65 73 20 6c 6f |,l(o) :.edges lo| 00000120 6f 6b 75 70 20 61 6e 64 20 6c 65 6e 67 74 68 0d |okup and length.| 00000130 00 64 19 e3 63 3d 31 b8 6f 3a f3 73 25 28 63 29 |.d..c=1.o:.s%(c)| 00000140 2c 65 25 28 63 29 3a ed 0d 00 6e 40 e3 63 3d 31 |,e%(c):...n@.c=1| 00000150 b8 6f 3a 6c 28 63 29 3d b6 28 28 78 28 73 25 28 |.o:l(c)=.((x(s%(| 00000160 63 29 29 2d 78 28 65 25 28 63 29 29 29 5e 32 2b |c))-x(e%(c)))^2+| 00000170 28 79 28 73 25 28 63 29 29 2d 79 28 65 25 28 63 |(y(s%(c))-y(e%(c| 00000180 29 29 29 5e 32 29 3a ed 0d 00 78 24 6b 3d 30 2e |)))^2):...x$k=0.| 00000190 32 35 20 20 20 20 20 20 3a f4 73 70 72 69 6e 67 |25 :.spring| 000001a0 73 27 20 73 74 69 66 66 6e 65 73 73 0d 00 82 1c |s' stiffness....| 000001b0 61 3d 2e 39 36 20 20 20 20 20 20 20 3a f4 61 62 |a=.96 :.ab| 000001c0 73 6f 72 70 74 69 6f 6e 0d 00 8c 19 67 3d 2e 31 |sorption....g=.1| 000001d0 20 20 20 20 20 20 20 20 3a f4 67 72 61 76 69 74 | :.gravit| 000001e0 79 0d 00 96 04 0d 00 a0 1c 62 25 3d 31 20 20 20 |y........b%=1 | 000001f0 20 20 20 20 20 3a f4 73 63 72 65 65 6e 62 61 6e | :.screenban| 00000200 6b 0d 00 aa 05 f5 0d 00 b4 24 20 f4 63 61 6c 63 |k........$ .calc| 00000210 75 6c 61 74 65 20 69 73 6f 62 61 72 79 63 65 6e |ulate isobarycen| 00000220 74 65 72 20 63 6f 6f 72 64 73 0d 00 be 31 20 78 |ter coords...1 x| 00000230 3d 30 3a 79 3d 30 3a e3 63 3d 31 b8 6e 3a 78 2b |=0:y=0:.c=1.n:x+| 00000240 3d 78 28 63 29 3a 79 2b 3d 79 28 63 29 3a ed 3a |=x(c):y+=y(c):.:| 00000250 78 3d 78 2f 6e 3a 79 3d 79 2f 6e 0d 00 c8 40 20 |x=x/n:y=y/n...@ | 00000260 f4 77 68 65 6e 20 70 6c 61 79 65 72 20 61 63 63 |.when player acc| 00000270 65 6c 65 72 61 74 65 2c 20 77 65 20 70 75 74 20 |elerate, we put | 00000280 74 68 69 73 20 61 63 63 65 6c 65 72 61 74 69 6f |this acceleratio| 00000290 6e 20 61 6c 6f 6e 67 20 74 68 65 0d 00 d2 22 20 |n along the..." | 000002a0 f4 69 73 6f 62 61 72 79 63 65 6e 74 65 72 2f 31 |.isobarycenter/1| 000002b0 73 74 20 62 72 6f 77 20 61 78 69 73 2e 0d 00 dc |st brow axis....| 000002c0 0d 20 e7 a6 28 ac 35 37 29 8c 0d 00 e6 19 20 20 |. ..(.57)..... | 000002d0 64 78 3d 78 28 31 29 2d 78 3a 64 79 3d 79 28 31 |dx=x(1)-x:dy=y(1| 000002e0 29 2d 79 0d 00 f0 14 20 20 64 3d b6 28 64 78 5e |)-y.... d=.(dx^| 000002f0 32 2b 64 79 5e 32 29 0d 00 fa 1b 20 20 e7 64 3c |2+dy^2).... .d<| 00000300 3e 30 8c 6e 78 3d 64 78 2f 64 3a 6e 79 3d 64 79 |>0.nx=dx/d:ny=dy| 00000310 2f 64 0d 01 04 26 20 20 e3 63 3d 31 b8 6e 3a 61 |/d...& .c=1.n:a| 00000320 78 28 63 29 3d 6e 78 2f 34 3a 61 79 28 63 29 3d |x(c)=nx/4:ay(c)=| 00000330 67 2b 6e 79 2f 34 3a ed 0d 01 0e 06 20 cc 0d 01 |g+ny/4:..... ...| 00000340 18 13 20 20 61 78 28 29 3d 30 3a 61 79 28 29 3d |.. ax()=0:ay()=| 00000350 67 0d 01 22 06 20 cd 0d 01 2c 4c 20 f4 77 68 65 |g..". ...,L .whe| 00000360 6e 20 70 6c 61 79 65 72 20 72 6f 74 61 74 65 73 |n player rotates| 00000370 2c 20 77 65 20 61 64 64 20 74 6f 20 65 61 63 68 |, we add to each| 00000380 20 62 72 6f 77 20 61 6e 20 61 63 63 65 6c 65 72 | brow an acceler| 00000390 61 74 69 6f 6e 20 70 65 72 70 65 6e 64 69 63 75 |ation perpendicu| 000003a0 6c 61 72 0d 01 36 25 20 f4 74 6f 20 74 68 65 20 |lar..6% .to the | 000003b0 69 73 6f 62 61 72 79 63 65 6e 74 65 72 2f 62 72 |isobarycenter/br| 000003c0 6f 77 20 61 78 69 73 2e 0d 01 40 0d 20 e7 a6 28 |ow axis...@. ..(| 000003d0 ac 32 35 29 8c 0d 01 4a 0c 20 20 e3 63 3d 31 b8 |.25)...J. .c=1.| 000003e0 6e 0d 01 54 1a 20 20 20 64 78 3d 78 28 63 29 2d |n..T. dx=x(c)-| 000003f0 78 3a 64 79 3d 79 28 63 29 2d 79 0d 01 5e 25 20 |x:dy=y(c)-y..^% | 00000400 20 20 64 3d b6 28 64 78 5e 32 2b 64 79 5e 32 29 | d=.(dx^2+dy^2)| 00000410 3a 6e 78 3d 64 78 2f 64 3a 6e 79 3d 64 79 2f 64 |:nx=dx/d:ny=dy/d| 00000420 0d 01 68 1e 20 20 20 61 78 28 63 29 2b 3d 6e 79 |..h. ax(c)+=ny| 00000430 2f 38 3a 61 79 28 63 29 2d 3d 6e 78 2f 38 0d 01 |/8:ay(c)-=nx/8..| 00000440 72 07 20 20 ed 0d 01 7c 06 20 cd 0d 01 86 0e 20 |r. ...|. ..... | 00000450 e7 a6 28 ac 31 32 31 29 8c 0d 01 90 0c 20 20 e3 |..(.121)..... .| 00000460 63 3d 31 b8 6e 0d 01 9a 1a 20 20 20 64 78 3d 78 |c=1.n.... dx=x| 00000470 28 63 29 2d 78 3a 64 79 3d 79 28 63 29 2d 79 0d |(c)-x:dy=y(c)-y.| 00000480 01 a4 25 20 20 20 64 3d b6 28 64 78 5e 32 2b 64 |..% d=.(dx^2+d| 00000490 79 5e 32 29 3a 6e 78 3d 64 78 2f 64 3a 6e 79 3d |y^2):nx=dx/d:ny=| 000004a0 64 79 2f 64 0d 01 ae 1e 20 20 20 61 78 28 63 29 |dy/d.... ax(c)| 000004b0 2d 3d 6e 79 2f 38 3a 61 79 28 63 29 2b 3d 6e 78 |-=ny/8:ay(c)+=nx| 000004c0 2f 38 0d 01 b8 07 20 20 ed 0d 01 c2 06 20 cd 0d |/8.... ..... ..| 000004d0 01 cc 37 20 c8 96 3a c8 99 22 4f 53 5f 42 79 74 |..7 ..:.."OS_Byt| 000004e0 65 22 2c 26 37 31 2c 62 25 3a 62 25 3d 62 25 82 |e",&71,b%:b%=b%.| 000004f0 33 3a c8 99 22 4f 53 5f 42 79 74 65 22 2c 26 37 |3:.."OS_Byte",&7| 00000500 30 2c 62 25 3a db 0d 01 d6 24 20 f4 43 6f 6d 70 |0,b%:....$ .Comp| 00000510 75 74 65 20 66 6f 72 63 65 20 66 6f 72 20 65 61 |ute force for ea| 00000520 63 68 20 73 70 72 69 6e 67 20 0d 01 e0 0b 20 e3 |ch spring .... .| 00000530 63 3d 31 b8 6f 0d 01 ea 1a 20 20 64 78 3d 78 28 |c=1.o.... dx=x(| 00000540 73 25 28 63 29 29 2d 78 28 65 25 28 63 29 29 0d |s%(c))-x(e%(c)).| 00000550 01 f4 1a 20 20 64 79 3d 79 28 73 25 28 63 29 29 |... dy=y(s%(c))| 00000560 2d 79 28 65 25 28 63 29 29 0d 01 fe 14 20 20 6c |-y(e%(c)).... l| 00000570 3d b6 28 64 78 5e 32 2b 64 79 5e 32 29 0d 02 08 |=.(dx^2+dy^2)...| 00000580 18 20 20 61 78 3d 28 6c 28 63 29 2d 6c 29 2a 6b |. ax=(l(c)-l)*k| 00000590 2a 64 78 2f 6c 0d 02 12 18 20 20 61 79 3d 28 6c |*dx/l.... ay=(l| 000005a0 28 63 29 2d 6c 29 2a 6b 2a 64 79 2f 6c 0d 02 1c |(c)-l)*k*dy/l...| 000005b0 21 20 20 61 78 28 73 25 28 63 29 29 2b 3d 61 78 |! ax(s%(c))+=ax| 000005c0 3a 61 78 28 65 25 28 63 29 29 2d 3d 61 78 0d 02 |:ax(e%(c))-=ax..| 000005d0 26 21 20 20 61 79 28 73 25 28 63 29 29 2b 3d 61 |&! ay(s%(c))+=a| 000005e0 79 3a 61 79 28 65 25 28 63 29 29 2d 3d 61 79 0d |y:ay(e%(c))-=ay.| 000005f0 02 30 06 20 ed 0d 02 3a 26 20 f4 63 6f 6d 70 75 |.0. ...:& .compu| 00000600 74 65 20 6d 6f 76 65 6d 65 6e 74 73 20 66 6f 72 |te movements for| 00000610 20 65 61 63 68 20 70 6f 69 6e 74 0d 02 44 0b 20 | each point..D. | 00000620 e3 63 3d 31 b8 6e 0d 02 4e 19 20 20 76 78 28 63 |.c=1.n..N. vx(c| 00000630 29 3d 76 78 28 63 29 2a 61 2b 61 78 28 63 29 0d |)=vx(c)*a+ax(c).| 00000640 02 58 19 20 20 76 79 28 63 29 3d 76 79 28 63 29 |.X. vy(c)=vy(c)| 00000650 2a 61 2b 61 79 28 63 29 0d 02 62 11 20 20 78 28 |*a+ay(c)..b. x(| 00000660 63 29 2b 3d 76 78 28 63 29 0d 02 6c 11 20 20 79 |c)+=vx(c)..l. y| 00000670 28 63 29 2b 3d 76 79 28 63 29 0d 02 76 21 20 20 |(c)+=vy(c)..v! | 00000680 e7 78 28 63 29 3c 30 8c 78 28 63 29 3d 30 3a 76 |.x(c)<0.x(c)=0:v| 00000690 78 28 63 29 3d 2d 76 78 28 63 29 0d 02 80 21 20 |x(c)=-vx(c)...! | 000006a0 20 e7 79 28 63 29 3c 30 8c 79 28 63 29 3d 30 3a | .y(c)<0.y(c)=0:| 000006b0 76 79 28 63 29 3d 2d 76 79 28 63 29 0d 02 8a 25 |vy(c)=-vy(c)...%| 000006c0 20 20 e7 78 28 63 29 3e 33 31 39 8c 78 28 63 29 | .x(c)>319.x(c)| 000006d0 3d 33 31 39 3a 76 78 28 63 29 3d 2d 76 78 28 63 |=319:vx(c)=-vx(c| 000006e0 29 0d 02 94 25 20 20 e7 79 28 63 29 3e 32 35 35 |)...% .y(c)>255| 000006f0 8c 79 28 63 29 3d 32 35 35 3a 76 79 28 63 29 3d |.y(c)=255:vy(c)=| 00000700 2d 76 79 28 63 29 0d 02 9e 06 20 ed 0d 02 a8 46 |-vy(c).... ....F| 00000710 20 e3 63 3d 31 b8 6f 3a 86 78 28 73 25 28 63 29 | .c=1.o:.x(s%(c)| 00000720 29 3c 3c 32 2c 32 35 35 2d 79 28 73 25 28 63 29 |)<<2,255-y(s%(c)| 00000730 29 3c 3c 32 2c 78 28 65 25 28 63 29 29 3c 3c 32 |)<<2,x(e%(c))<<2| 00000740 2c 32 35 35 2d 79 28 65 25 28 63 29 29 3c 3c 32 |,255-y(e%(c))<<2| 00000750 3a ed 0d 02 b2 06 fd a3 0d 02 bc 05 e0 0d 02 c6 |:...............| 00000760 04 0d 02 d0 19 f4 6e 62 5f 63 6f 6f 72 64 73 20 |......nb_coords | 00000770 26 20 6e 62 5f 65 64 67 65 73 0d 02 da 08 dc 33 |& nb_edges.....3| 00000780 2c 33 0d 02 e4 0b f4 63 6f 6f 72 64 73 0d 02 ee |,3.....coords...| 00000790 1b dc 20 30 2c 33 30 2c 20 2d 31 35 2c 2d 31 35 |.. 0,30, -15,-15| 000007a0 2c 20 31 35 2c 2d 31 35 0d 02 f8 0a f4 65 64 67 |, 15,-15.....edg| 000007b0 65 73 0d 03 02 13 dc 20 31 2c 32 2c 20 31 2c 33 |es..... 1,2, 1,3| 000007c0 2c 20 32 2c 33 0d ff |, 2,3..| 000007c7