I'll first paste a short msx basic listing:
100 SCREEN 1,2,0 110 VPOKE BASE(9)+0,&B0110 120 VPOKE BASE(9)+1,&B1111 130 VPOKE BASE(9)+2,&B1111 140 VPOKE BASE(9)+3,&B0110 150 A=100:B=100:X=70:Y=70 160 D=STICK(0) 170 IF D=1 THEN Y=Y-1 180 IF D=3 THEN X=X+1 190 IF D=5 THEN Y=Y+1 200 IF D=7 THEN X=X-1 210 PUT SPRITE 1,(X,Y),15,0 220 PUT SPRITE 2,(A,B),8,0 230 'LOCATE 1,1:PRINT X-A;Y-B 240 IF ABS(B-Y)<10 AND ABS(A-X)<10 THEN B=B-((Y-B)/3):A=A-((X-A)/3) 250 IF INKEY$=CHR$(27)THEN SCREEN0:END 260 GOTO 160
in short: imagine you are playing nemesis and a bullet comes close to your ship... you push a button and the bullet changes course by a negative force field (see program above)
How would you program this?
Login or 등록 to post comments



If anyone has some improvements on the math:
)