1 ' 3D rocket simulator
\r
2 ' made by Svjatoslav Agejenko
\r
4 ' H-Page: svjatoslav.eu
\r
5 ' E-Mail: svjatoslav@svjatoslav.eu
\r
7 ' arrow keys - move around
\r
8 ' 2, 6, 4, 8 - look around
\r
16 DECLARE SUB teerock ()
\r
17 DECLARE SUB teemaa ()
\r
18 DECLARE SUB start ()
\r
21 DIM SHARED px(1 TO 1500)
\r
22 DIM SHARED py(1 TO 1500)
\r
23 DIM SHARED pz(1 TO 1500)
\r
25 DIM SHARED l1(1 TO 3000)
\r
26 DIM SHARED l2(1 TO 3000)
\r
27 DIM SHARED lc(1 TO 3000)
\r
29 DIM SHARED rpx(1 TO 1900)
\r
30 DIM SHARED rpy(1 TO 1900)
\r
32 DIM SHARED rkx(1 TO 200)
\r
33 DIM SHARED rky(1 TO 200)
\r
34 DIM SHARED rkz(1 TO 200)
\r
36 DIM SHARED mitp, mitl
\r
37 DIM SHARED myx, myy, myz
\r
38 DIM SHARED myxp, myyp, myzp
\r
42 DIM SHARED ox1(1 TO 2500)
\r
43 DIM SHARED oy1(1 TO 2500)
\r
44 DIM SHARED ox2(1 TO 2500)
\r
45 DIM SHARED oy2(1 TO 2500)
\r
46 DIM SHARED frm, frm2, frm3
\r
48 DIM SHARED mk, mks, rs, rst
\r
50 DIM SHARED rkb, rke, rkm
\r
51 DIM SHARED rx, ry, rz, rxp, ryp, rzp
\r
75 PRINT mitp, mitl, mk, mks
\r
77 PRINT rkb, rke, TIMER
\r
80 rx = rx + (rxp * ts)
\r
81 ry = ry + (ryp * ts)
\r
82 rz = rz + (rzp * ts)
\r
84 ryp = ryp + (.0098 * ts)
\r
85 rxp = SIN(frm / 20) / 50
\r
89 px(a + rkb - 1) = rkx(a) + rx
\r
90 py(a + rkb - 1) = rky(a) + ry
\r
91 pz(a + rkb - 1) = rkz(a) + rz
\r
95 myx = myx + (myxp * ts)
\r
96 myy = myy + (myyp * ts)
\r
97 myz = myz + (myzp * ts)
\r
105 IF a$ = CHR$(0) + "H" THEN
\r
106 myzp = myzp - SIN(my1) / 100
\r
107 myxp = myxp + COS(my1) / 100
\r
109 IF a$ = CHR$(0) + "P" THEN
\r
110 myzp = myzp + SIN(my1) / 100
\r
111 myxp = myxp - COS(my1) / 100
\r
114 IF a$ = CHR$(0) + "M" THEN
\r
115 myzp = myzp + COS(my1) / 100
\r
116 myxp = myxp + SIN(my1) / 100
\r
118 IF a$ = CHR$(0) + "K" THEN
\r
119 myzp = myzp - COS(my1) / 100
\r
120 myxp = myxp - SIN(my1) / 100
\r
124 IF a$ = CHR$(27) THEN SYSTEM
\r
125 IF a$ = "4" THEN my1 = my1 + .1
\r
126 IF a$ = "6" THEN my1 = my1 - .1
\r
127 IF a$ = "2" THEN my2 = my2 + .1
\r
128 IF a$ = "8" THEN my2 = my2 - .1
\r
129 IF a$ = "-" THEN myyp = myyp + .01
\r
130 IF a$ = "+" THEN myyp = myyp - .01
\r
131 IF a$ = " " THEN myzp = myzp / 2: myxp = myxp / 2
\r
135 v = SQR(rx * rx + ry * ry + rz * rz)
\r
136 s = SQR(rxp * rxp + ryp * ryp + rzp * rzp)
\r
139 IF tmr$ <> TIME$ THEN
\r
143 PRINT "speed"; INT(s * 1000)
\r
145 PRINT "fps"; frm3; "timeslice"; INT(ts * 1000); "distance"; v;
\r
171 'DIM SHARED mitp, mitl
\r
178 px(mitp) = rx - .001
\r
179 py(mitp) = ry - .001
\r
183 px(mitp) = rx + .001
\r
184 py(mitp) = ry - .001
\r
189 l2(mitl) = mitp - 1
\r
193 l1(mitl) = mitp - 2
\r
194 l2(mitl) = mitp - 1
\r
199 l2(mitl) = mitp - 2
\r
219 x1 = x * s1 + z * c1
\r
220 z1 = x * c1 - z * s1
\r
222 y1 = z1 * s2 + y * c2
\r
223 z2 = z1 * c2 - y * s2
\r
225 IF z2 < .00001 THEN
\r
228 rpx(a) = x1 / z2 * 200 + 320
\r
229 rpy(a) = 240 - y1 / z2 * 200
\r
230 IF rpx(a) < -50 OR rpx(a) > 1000 OR rpy(a) < -50 OR rpy(a) > 1000 THEN rpx(a) = -1
\r
243 IF ox1(a) = -1 OR ox2(a) = -1 THEN ELSE LINE (ox1(a), oy1(a))-(ox2(a), oy2(a)), 0
\r
244 IF x1 = -1 OR x2 = -1 THEN GOTO 2
\r
245 LINE (x1, y1)-(x2, y2), lc(a)
\r
321 rkm = rke - rkb + 1
\r
322 'DIM SHARED rkx(1 TO 1000)
\r
323 'DIM SHARED rky(1 TO 1000)
\r
324 'DIM SHARED rkz(1 TO 1000)
\r
340 FOR z = -(mk / 3) TO (mk / 3) STEP mks
\r
343 FOR x = -(mk / 3) TO (mk / 3) STEP mks
\r
346 IF SQR(x * x + z * z) > (mk / 2.5) THEN GOTO 4
\r
348 IF le = 1 THEN xs = (x / mks)
\r
351 v = SQR(x * x + z * z)
\r
352 py(mitp) = SQR((v + (mk / 2)) * ((mk / 2) - v))
\r
357 l2(mitl) = mitp - 1
\r
362 IF xso > (x / mks) THEN GOTO 4
\r
363 IF xso + leo <= (x / mks) THEN GOTO 4
\r
367 l2(mitl) = mitp - leo - xso + xs
\r
383 FOR y = -9 TO 10 STEP rst
\r
385 IF y > 5 THEN s = s - 3
\r
386 IF y > 8 THEN s = s - 6
\r
387 FOR a = 0 TO pi * 2 STEP st
\r
390 'DIM SHARED mitp, mitl
\r
391 'DIM SHARED px(1 TO 4000)
\r
392 'DIM SHARED py(1 TO 4000)
\r
393 'DIM SHARED pz(1 TO 4000)
\r
394 'DIM SHARED l1(1 TO 7000)
\r
395 'DIM SHARED l2(1 TO 7000)
\r
396 'DIM SHARED lc(1 TO 7000)
\r
400 py(mitp) = y * 50 * rs
\r
406 l2(mitl) = mitp - 1
\r
413 l2(mitl) = mitp - 7
\r
422 py(mitp) = 11 * 50 * rs
\r
429 l2(mitl) = mitp - a
\r
434 px(mitp) = -100 * rs
\r
435 py(mitp) = -450 * rs
\r
439 px(mitp) = 100 * rs
\r
440 py(mitp) = -450 * rs
\r
445 py(mitp) = -200 * rs
\r
450 l2(mitl) = mitp - 1
\r
454 l1(mitl) = mitp - 2
\r
455 l2(mitl) = mitp - 1
\r
460 l2(mitl) = mitp - 2
\r
467 py(mitp) = -450 * rs
\r
468 pz(mitp) = -100 * rs
\r
472 py(mitp) = -450 * rs
\r
473 pz(mitp) = 100 * rs
\r
478 l2(mitl) = mitp - 1
\r
482 l1(mitl) = mitp - 2
\r
483 l2(mitl) = mitp - 1
\r
488 l2(mitl) = mitp - 2
\r