Author Topic: Flight Simulator  (Read 2205 times)

0 Members and 1 Guest are viewing this topic.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Flight Simulator
« Reply #15 on: May 27, 2020, 03:28:36 am »
Cool... Much improved!
Logic is the beginning of wisdom.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Flight Simulator
« Reply #16 on: May 27, 2020, 12:11:15 pm »
Thanks Johno. :) I'll be busy today so hopefully soon I'll work on it more.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Flight Simulator
« Reply #17 on: May 29, 2020, 04:00:57 pm »
I fixed the hills so they won't be seen in the sky anymore at all. LOL
I am having difficulty trying to remove the black pixels in the land that show up when you turn. Does anyone have any ideas on how to remove them? The land is made using LINE commands and when you turn they go at an angle which is why they show up. But I've tried POINT scans to find them and fill them with PSET's but no luck yet. Maybe I haven't found the right color yet. Although I did copy the image and pasted it in Paint.Net and used the color picker to get the exact RGB amount and it's 0,0,0 it says, which doesn't work on my scan. Not sure what's going on. I removed the scan commands for this update, but they were right after the first 2 loops under grid: and CLS right after it draws the sky and land. I've tried CP in both red, green, and/or blue but no luck. The scan I used was this:

Edit: Most pixelation has been fixed, scroll down to the next post for the update.

Code: QB64: [Select]
  1. FOR PCX=0 to 800
  2. FOR PCY=300 to 600
  3. IF POINT(PCX,PCY)=_RGB32(0,0,CP) THEN PSET (PCX,PCY),_RGB32(0,150,0)
  4. CP=CP+1
  5. NEXT PCY
  6. NEXT PCX
  7.  

Here's the update with the hills fix:

Code: QB64: [Select]
  1. 'Flying - By SierraKen
  2. 'Made on May 26, 2020.
  3. 'V. 1.0 - Removed grid lines and made ground and sky look better.
  4. 'Thank you bplus for sky and ground idea.
  5.  
  6. DIM waterx(500), watery(500), shape(500), watersz(500)
  7. DIM hillx(500), hilly(500), hshape(500), hillsz(500), hcolor(500)
  8. DIM cloudx(500), cloudy(500), shapecl(500), cloudsz(500)
  9. SCREEN _NEWIMAGE(800, 600, 32)
  10. xs = 10
  11. c = 0
  12. e = 100
  13. d = 0
  14. FOR g = 1 TO 20
  15.     GOSUB grid:
  16.  
  17. _TITLE "Down arrow goes up. Up arrow goes down. + and - number pad keys are the accelerator. Left and Right keys turn."
  18.     _LIMIT 3000
  19.     a$ = INKEY$
  20.  
  21.     IF a$ = CHR$(0) + CHR$(72) THEN d = 6: e = e + .5: b = 0 'Up arrow key flies down.
  22.     IF a$ = CHR$(0) + CHR$(80) THEN d = 5: e = e - .5: b = 0 'Down arrow key flies up.
  23.     IF a$ = "+" THEN d = 1: speed2 = speed2 + 10
  24.     IF a$ = "-" THEN
  25.         speed2 = speed2 - 10
  26.     END IF
  27.     IF speed2 <= 0 THEN speed = 0: b = 1: d = 0
  28.     IF a$ = CHR$(0) + CHR$(77) THEN d = 3: speed2 = speed2 + .2 'Right
  29.     IF a$ = CHR$(0) + CHR$(75) THEN d = 4: speed2 = speed2 + .2 'Left
  30.     IF a$ = CHR$(27) THEN END
  31.     IF d = 1 THEN speed = speed + 2: b = 0
  32.     IF d = 3 AND speed > 0 THEN
  33.         v = v - 1
  34.         vv = vv - 2
  35.         tilt = tilt - 3
  36.     END IF
  37.     IF d = 4 AND speed > 0 THEN
  38.         v = v + 1
  39.         vv = vv + 2
  40.         tilt = tilt + 3
  41.     END IF
  42.     IF d = 3 AND speed <= 0 THEN
  43.         v = v - 1
  44.         vv = vv - 2
  45.         tilt = tilt - 3
  46.         speed = speed + 4
  47.     END IF
  48.     IF d = 4 AND speed <= 0 THEN
  49.         v = v + 1
  50.         vv = vv + 2
  51.         tilt = tilt + 3
  52.         speed = speed + 4
  53.     END IF
  54.     IF d = 5 OR speed2 > 0 THEN speed = speed + 1: b = 0
  55.     IF d = 6 OR speed2 > 0 THEN speed = speed + 1: b = 0
  56.  
  57.     IF tilt > 175 THEN tilt = 175
  58.     IF tilt < -175 THEN tilt = -175
  59.     IF (d = 3 OR d = 4 OR d = 5 OR d = 6) AND b = 0 THEN speed = speed + 1
  60.     IF (d = 3 OR d = 4) AND b = 1 THEN speed = speed - 1
  61.     IF e > 100 THEN e = 100
  62.     IF e < 0 THEN e = 0
  63.     elevation = e - 100
  64.     elevation = -elevation
  65.     elevation = elevation * 100
  66.     IF d <> 0 THEN GOSUB grid:
  67.     IF speed2 < 0 THEN speed2 = 0
  68.     IF speed2 > 1000 THEN speed2 = 1000
  69.     delay = 1 / speed2
  70.     IF delay < .001 THEN delay = .001
  71.     IF delay > .02 THEN delay = .02
  72.     _DELAY delay
  73.  
  74. grid:
  75. FOR bsky = 0 TO 300 STEP .25
  76.     LINE (0, bsky - e - tilt)-(800, bsky - e + tilt), _RGB32(0, 0, bsky)
  77.     LINE (0, bsky - e - tilt + .12)-(800, bsky - e + tilt + .12), _RGB32(0, 0, bsky)
  78. NEXT bsky
  79.  
  80. FOR ground = 300 TO 900 STEP .25
  81.     IF ground = INT(ground) THEN ground2 = ground2 + 1
  82.     LINE (0, ground - e - tilt)-(800, ground - e + tilt), _RGB32(0, ground2, 0)
  83.     LINE (0, ground - e - tilt + .12)-(800, ground - e + tilt + .12), _RGB32(0, ground2, 0)
  84. NEXT ground
  85. ground2 = 0
  86. 'FOR PCX = 0 TO 800
  87. '    FOR PCY = 300 TO 600 STEP .25
  88. '    IF POINT(PCX, PCY) = _RGB32(0, 0, CP) THEN PSET (PCX, PCY), _RGB32(0, 150, 0)
  89. 'CP = CP + 1
  90. 'NEXT PCY
  91. 'NEXT PCX
  92.  
  93.  
  94. 'Calculate Compass
  95. tilt2 = tilt
  96. IF tilt2 < 0 THEN tilt2 = -tilt2
  97.  
  98. IF tilt < 0 THEN c = c - tilt2 / 314
  99. IF tilt > 0 THEN c = c + tilt2 / 314
  100. IF c > 359 THEN c = 0
  101. IF c < 0 THEN c = 359
  102. cc = INT(c)
  103. IF cc >= 340 OR cc < 25 THEN comp$ = "North"
  104. IF cc >= 25 AND cc < 65 THEN comp$ = "Northeast"
  105. IF cc >= 65 AND cc < 115 THEN comp$ = "East"
  106. IF cc >= 115 AND cc < 160 THEN comp$ = "Southeast"
  107. IF cc >= 160 AND cc < 205 THEN comp$ = "South"
  108. IF cc >= 205 AND cc < 250 THEN comp$ = "Southwest"
  109. IF cc >= 250 AND cc < 295 THEN comp$ = "West"
  110. IF cc >= 295 AND cc < 340 THEN comp$ = "Northwest"
  111. _PRINTSTRING (390, 550), comp$
  112. cc$ = STR$(cc)
  113. _PRINTSTRING (395, 570), cc$
  114.  
  115. 'Sun
  116. IF cc < 225 OR cc > 315 THEN til = 0: GOTO nosun:
  117. tilt3 = tilt / 50
  118. IF cc = 315 THEN sunx = 800
  119. IF cc = 225 THEN sunx = 0
  120. IF cc < 315 AND tilt < 0 AND tilt3 = oldtilt3 THEN sunx = sunx - 10: til = til - tilt3
  121. IF cc > 225 AND tilt > 0 AND tilt3 = oldtilt3 THEN sunx = sunx + 10: til = til + tilt3
  122. oldtilt3 = tilt3
  123. FOR sz = .25 TO 10 STEP .25
  124.     CIRCLE (sunx, til), sz, _RGB32(255, 255, 127)
  125. NEXT sz
  126. nosun:
  127.  
  128. 'Clouds
  129. clouds = INT(RND * 200) + 1
  130. IF clouds > 190 THEN
  131.     cl = cl + 1
  132.     IF cl > 100 THEN cl = 1
  133.     cloudx(cl) = INT(RND * 799) + 1
  134.     cloudy(cl) = 180
  135.     cloudsz(cl) = INT(RND * 5) + 1 + e / 1.5
  136.     IF cloudsz(cl) < 10 THEN cloudsz(cl) = 10
  137.     shapecl(cl) = (RND - .4)
  138.     IF shapecl(cl) < .4 THEN shapecl(cl) = .4
  139. IF cl = 0 THEN GOTO skipclouds2:
  140. FOR cl2 = 1 TO cl
  141.     cloudy(cl2) = cloudy(cl2) - speed2 / 125
  142.     tilt6 = tilt / 5
  143.     IF tilt6 < 0 THEN tilt6 = -tilt6
  144.     cloudy(cl2) = cloudy(cl2) + tilt6 / 10
  145.     IF cloudy(cl2) < -50 THEN GOTO skipclouds:
  146.     ttttilt = tilt / 10
  147.     IF ttttilt > 6 THEN ttttilt = 6
  148.     IF ttttilt < -6 THEN ttttilt = -6
  149.     cloudx(cl2) = cloudx(cl2) + ttttilt
  150.     IF cloudx(cl2) < -50 OR cloudx(cl2) > 850 THEN GOTO skipclouds:
  151.     IF cloudy(cl2) >= 175 THEN ccl = 100
  152.     IF cloudy(cl2) < 175 AND cloudy(cl2) >= 150 THEN ccl = 125
  153.     IF cloudy(cl2) < 150 AND cloudy(cl2) >= 125 THEN ccl = 150
  154.     IF cloudy(cl2) < 125 AND cloudy(cl2) >= 100 THEN ccl = 175
  155.     IF cloudy(cl2) < 100 AND cloudy(cl2) >= 75 THEN ccl = 200
  156.     IF cloudy(cl2) < 75 AND cloudy(cl2) >= 50 THEN ccl = 225
  157.     IF cloudy(cl2) < 50 THEN ccl = 255
  158.     FOR sz = .25 TO cloudsz(cl2) STEP .25
  159.         CIRCLE (cloudx(cl2), cloudy(cl2)), sz, _RGB32(ccl, ccl, ccl), , , shapecl(cl2)
  160.     NEXT sz
  161.     skipclouds:
  162. NEXT cl2
  163. skipclouds2:
  164.  
  165. 'Water
  166. water = INT(RND * 200) + 1
  167. IF water > 197 THEN
  168.     w = w + 1
  169.     IF w > 100 THEN w = 1
  170.     waterx(w) = INT(RND * 799) + 1
  171.     watery(w) = 310
  172.     watersz(w) = INT(RND * 5) + 1 + e / 1.5
  173.     shape(w) = (RND - .35)
  174. IF w = 0 THEN GOTO skipwater2:
  175. FOR ww = 1 TO w
  176.     watery(ww) = watery(ww) + speed2 / 125
  177.     tilt4 = tilt / 5
  178.     IF tilt4 < 0 THEN tilt4 = -tilt4
  179.     watery(ww) = watery(ww) + tilt4 / 10
  180.     IF watery(ww) > 650 THEN GOTO skipwater:
  181.     ttilt = tilt / 10
  182.     IF ttilt > 6 THEN ttilt = 6
  183.     IF ttilt < -6 THEN ttilt = -6
  184.     waterx(ww) = waterx(ww) + ttilt
  185.     FOR chilly = 0 TO 300
  186.         IF POINT(hillx(hh), hilly(hh)) = _RGB32(0, 0, chilly) THEN GOTO skipwater:
  187.     NEXT chilly
  188.     IF waterx(ww) < -50 OR waterx(ww) > 850 THEN GOTO skipwater:
  189.     FOR sz = .25 TO watersz(ww) STEP .25
  190.         CIRCLE (waterx(ww), watery(ww)), sz, _RGB32(100, 100, 255), , , shape(ww)
  191.     NEXT sz
  192.     skipwater:
  193. NEXT ww
  194. skipwater2:
  195.  
  196. 'Hills
  197. hills = INT(RND * 200) + 1
  198. IF hills > 150 THEN
  199.     h = h + 1
  200.     IF h > 300 THEN h = 1
  201.     hillx(h) = INT(RND * 799) + 1
  202.     hilly(h) = 310
  203.     hillsz(h) = INT(RND * 5) + 1 + e / 1.5
  204.     hshape(h) = (RND - .35)
  205.     hcolor(h) = INT(RND * 100) + 100
  206. IF h = 0 THEN GOTO skiphill2:
  207. FOR hh = 1 TO h
  208.     IF speed2 > 0 THEN hilly(hh) = hilly(hh) + speed2 / 125
  209.     tilt5 = tilt / 5
  210.     IF tilt5 < 0 THEN tilt5 = -tilt5
  211.     hilly(hh) = hilly(hh) + tilt5 / 10
  212.     IF hilly(hh) > 650 THEN GOTO skiphill:
  213.     tttilt = tilt / 10
  214.     IF tttilt > 6 THEN tttilt = 6
  215.     IF tttilt < -6 THEN tttilt = -6
  216.     hillx(hh) = hillx(hh) + tttilt
  217.     FOR chilly = 0 TO 300
  218.         IF POINT(hillx(hh), hilly(hh)) = _RGB32(0, 0, chilly) THEN GOTO skiphill:
  219.     NEXT chilly
  220.     IF hillx(hh) < 0 OR hillx(hh) > 800 THEN GOTO skiphill:
  221.     FOR sz = .25 TO hillsz(hh) STEP .25
  222.         CIRCLE (hillx(hh), hilly(hh)), sz, _RGB32(hcolor(hh), hcolor(hh) + 44, 0), 2 * _PI, _PI, hshape(hh)
  223.     NEXT sz
  224.     skiphill:
  225. NEXT hh
  226. skiphill2:
  227.  
  228. _PRINTSTRING (250, 550), "Altitude"
  229. elevation$ = STR$(elevation)
  230. _PRINTSTRING (255, 570), elevation$
  231.  
  232. _PRINTSTRING (530, 550), "Airspeed"
  233. speed2 = INT(speed2)
  234. speed2$ = STR$(speed2)
  235. _PRINTSTRING (535, 570), speed2$
  236.  
  237. xx = 0: xx2 = 0: xx3 = 0
  238.  
  239.  
« Last Edit: May 29, 2020, 08:01:29 pm by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Flight Simulator
« Reply #18 on: May 29, 2020, 08:02:46 pm »
I was able to fix most of the pixelation problem by just adding more LINE commands. There's still a couple on the very side but I'm not going to worry about it.
Here is the update:

Code: QB64: [Select]
  1. 'Flying - By SierraKen
  2. 'Made on May 29, 2020.
  3. 'V. 1.1 - Fixed hills from being in the sky and most pixelation on land.
  4.  
  5. DIM waterx(500), watery(500), shape(500), watersz(500)
  6. DIM hillx(500), hilly(500), hshape(500), hillsz(500), hcolor(500)
  7. DIM cloudx(500), cloudy(500), shapecl(500), cloudsz(500)
  8. SCREEN _NEWIMAGE(800, 600, 32)
  9. xs = 10
  10. c = 0
  11. e = 100
  12. d = 0
  13. FOR g = 1 TO 20
  14.     GOSUB grid:
  15.  
  16. _TITLE "Down arrow goes up. Up arrow goes down. + and - number pad keys are the accelerator. Left and Right keys turn."
  17.     _LIMIT 4000
  18.     a$ = INKEY$
  19.  
  20.     IF a$ = CHR$(0) + CHR$(72) THEN d = 6: e = e + .5: b = 0 'Up arrow key flies down.
  21.     IF a$ = CHR$(0) + CHR$(80) THEN d = 5: e = e - .5: b = 0 'Down arrow key flies up.
  22.     IF a$ = "+" THEN d = 1: speed2 = speed2 + 10
  23.     IF a$ = "-" THEN
  24.         speed2 = speed2 - 10
  25.     END IF
  26.     IF speed2 <= 0 THEN speed = 0: b = 1: d = 0
  27.     IF a$ = CHR$(0) + CHR$(77) THEN d = 3: speed2 = speed2 + .2 'Right
  28.     IF a$ = CHR$(0) + CHR$(75) THEN d = 4: speed2 = speed2 + .2 'Left
  29.     IF a$ = CHR$(27) THEN END
  30.     IF d = 1 THEN speed = speed + 2: b = 0
  31.     IF d = 3 AND speed > 0 THEN
  32.         v = v - 1
  33.         vv = vv - 2
  34.         tilt = tilt - 3
  35.     END IF
  36.     IF d = 4 AND speed > 0 THEN
  37.         v = v + 1
  38.         vv = vv + 2
  39.         tilt = tilt + 3
  40.     END IF
  41.     IF d = 3 AND speed <= 0 THEN
  42.         v = v - 1
  43.         vv = vv - 2
  44.         tilt = tilt - 3
  45.         speed = speed + 4
  46.     END IF
  47.     IF d = 4 AND speed <= 0 THEN
  48.         v = v + 1
  49.         vv = vv + 2
  50.         tilt = tilt + 3
  51.         speed = speed + 4
  52.     END IF
  53.     IF d = 5 OR speed2 > 0 THEN speed = speed + 1: b = 0
  54.     IF d = 6 OR speed2 > 0 THEN speed = speed + 1: b = 0
  55.  
  56.     IF tilt > 175 THEN tilt = 175
  57.     IF tilt < -175 THEN tilt = -175
  58.     IF (d = 3 OR d = 4 OR d = 5 OR d = 6) AND b = 0 THEN speed = speed + 1
  59.     IF (d = 3 OR d = 4) AND b = 1 THEN speed = speed - 1
  60.     IF e > 100 THEN e = 100
  61.     IF e < 0 THEN e = 0
  62.     elevation = e - 100
  63.     elevation = -elevation
  64.     elevation = elevation * 100
  65.     IF d <> 0 THEN GOSUB grid:
  66.     IF speed2 < 0 THEN speed2 = 0
  67.     IF speed2 > 1000 THEN speed2 = 1000
  68.     delay = 1 / speed2 * 2
  69.     IF delay < .0005 THEN delay = .0005
  70.     IF delay > .005 THEN delay = .005
  71.     _DELAY delay
  72.  
  73. grid:
  74. FOR bsky = 0 TO 300 STEP .25
  75.     LINE (0, bsky - e - tilt)-(800, bsky - e + tilt), _RGB32(0, 0, bsky)
  76.     LINE (0, bsky - e - tilt + .125)-(800, bsky - e + tilt - .125), _RGB32(0, 0, bsky)
  77.     LINE (0, bsky - e - tilt - .125)-(800, bsky - e + tilt + .125), _RGB32(0, 0, bsky)
  78. NEXT bsky
  79.  
  80. FOR ground = 300 TO 900 STEP .25
  81.     IF ground = INT(ground) THEN ground2 = ground2 + 1
  82.     LINE (0, ground - e - tilt)-(800, ground - e + tilt), _RGB32(0, ground2, 0)
  83.     LINE (0, ground - e - tilt + .125)-(800, ground - e + tilt - .125), _RGB32(0, ground2, 0)
  84.     LINE (0, ground - e - tilt - .125)-(800, ground - e + tilt + .125), _RGB32(0, ground2, 0)
  85.  
  86. NEXT ground
  87. ground2 = 0
  88.  
  89. 'Calculate Compass
  90. tilt2 = tilt
  91. IF tilt2 < 0 THEN tilt2 = -tilt2
  92.  
  93. IF tilt < 0 THEN c = c - tilt2 / 314
  94. IF tilt > 0 THEN c = c + tilt2 / 314
  95. IF c > 359 THEN c = 0
  96. IF c < 0 THEN c = 359
  97. cc = INT(c)
  98. IF cc >= 340 OR cc < 25 THEN comp$ = "North"
  99. IF cc >= 25 AND cc < 65 THEN comp$ = "Northeast"
  100. IF cc >= 65 AND cc < 115 THEN comp$ = "East"
  101. IF cc >= 115 AND cc < 160 THEN comp$ = "Southeast"
  102. IF cc >= 160 AND cc < 205 THEN comp$ = "South"
  103. IF cc >= 205 AND cc < 250 THEN comp$ = "Southwest"
  104. IF cc >= 250 AND cc < 295 THEN comp$ = "West"
  105. IF cc >= 295 AND cc < 340 THEN comp$ = "Northwest"
  106. _PRINTSTRING (390, 550), comp$
  107. cc$ = STR$(cc)
  108. _PRINTSTRING (395, 570), cc$
  109.  
  110. 'Sun
  111. IF cc < 225 OR cc > 315 THEN til = 0: GOTO nosun:
  112. tilt3 = tilt / 50
  113. IF cc = 315 THEN sunx = 800
  114. IF cc = 225 THEN sunx = 0
  115. IF cc < 315 AND tilt < 0 AND tilt3 = oldtilt3 THEN sunx = sunx - 10: til = til - tilt3
  116. IF cc > 225 AND tilt > 0 AND tilt3 = oldtilt3 THEN sunx = sunx + 10: til = til + tilt3
  117. oldtilt3 = tilt3
  118. FOR sz = .25 TO 10 STEP .25
  119.     CIRCLE (sunx, til), sz, _RGB32(255, 255, 127)
  120. NEXT sz
  121. nosun:
  122.  
  123. 'Clouds
  124. clouds = INT(RND * 200) + 1
  125. IF clouds > 190 THEN
  126.     cl = cl + 1
  127.     IF cl > 100 THEN cl = 1
  128.     cloudx(cl) = INT(RND * 799) + 1
  129.     cloudy(cl) = 180
  130.     cloudsz(cl) = INT(RND * 5) + 1 + e / 1.5
  131.     IF cloudsz(cl) < 10 THEN cloudsz(cl) = 10
  132.     shapecl(cl) = (RND - .4)
  133.     IF shapecl(cl) < .4 THEN shapecl(cl) = .4
  134. IF cl = 0 THEN GOTO skipclouds2:
  135. FOR cl2 = 1 TO cl
  136.     cloudy(cl2) = cloudy(cl2) - speed2 / 125
  137.     tilt6 = tilt / 5
  138.     IF tilt6 < 0 THEN tilt6 = -tilt6
  139.     cloudy(cl2) = cloudy(cl2) + tilt6 / 10
  140.     IF cloudy(cl2) < -50 THEN GOTO skipclouds:
  141.     ttttilt = tilt / 10
  142.     IF ttttilt > 6 THEN ttttilt = 6
  143.     IF ttttilt < -6 THEN ttttilt = -6
  144.     cloudx(cl2) = cloudx(cl2) + ttttilt
  145.     IF cloudx(cl2) < -50 OR cloudx(cl2) > 850 THEN GOTO skipclouds:
  146.     IF cloudy(cl2) >= 175 THEN ccl = 100
  147.     IF cloudy(cl2) < 175 AND cloudy(cl2) >= 150 THEN ccl = 125
  148.     IF cloudy(cl2) < 150 AND cloudy(cl2) >= 125 THEN ccl = 150
  149.     IF cloudy(cl2) < 125 AND cloudy(cl2) >= 100 THEN ccl = 175
  150.     IF cloudy(cl2) < 100 AND cloudy(cl2) >= 75 THEN ccl = 200
  151.     IF cloudy(cl2) < 75 AND cloudy(cl2) >= 50 THEN ccl = 225
  152.     IF cloudy(cl2) < 50 THEN ccl = 255
  153.     FOR sz = .25 TO cloudsz(cl2) STEP .25
  154.         CIRCLE (cloudx(cl2), cloudy(cl2)), sz, _RGB32(ccl, ccl, ccl), , , shapecl(cl2)
  155.     NEXT sz
  156.     skipclouds:
  157. NEXT cl2
  158. skipclouds2:
  159.  
  160. 'Water
  161. water = INT(RND * 200) + 1
  162. IF water > 197 THEN
  163.     w = w + 1
  164.     IF w > 100 THEN w = 1
  165.     waterx(w) = INT(RND * 799) + 1
  166.     watery(w) = 310
  167.     watersz(w) = INT(RND * 5) + 1 + e / 1.5
  168.     shape(w) = (RND - .35)
  169. IF w = 0 THEN GOTO skipwater2:
  170. FOR ww = 1 TO w
  171.     watery(ww) = watery(ww) + speed2 / 125
  172.     tilt4 = tilt / 5
  173.     IF tilt4 < 0 THEN tilt4 = -tilt4
  174.     watery(ww) = watery(ww) + tilt4 / 10
  175.     IF watery(ww) > 650 THEN GOTO skipwater:
  176.     ttilt = tilt / 10
  177.     IF ttilt > 6 THEN ttilt = 6
  178.     IF ttilt < -6 THEN ttilt = -6
  179.     waterx(ww) = waterx(ww) + ttilt
  180.     FOR chilly = 0 TO 300
  181.         IF POINT(hillx(hh), hilly(hh)) = _RGB32(0, 0, chilly) THEN GOTO skipwater:
  182.     NEXT chilly
  183.     IF waterx(ww) < -50 OR waterx(ww) > 850 THEN GOTO skipwater:
  184.     FOR sz = .25 TO watersz(ww) STEP .25
  185.         CIRCLE (waterx(ww), watery(ww)), sz, _RGB32(100, 100, 255), , , shape(ww)
  186.     NEXT sz
  187.     skipwater:
  188. NEXT ww
  189. skipwater2:
  190.  
  191. 'Hills
  192. hills = INT(RND * 200) + 1
  193. IF hills > 150 THEN
  194.     h = h + 1
  195.     IF h > 300 THEN h = 1
  196.     hillx(h) = INT(RND * 799) + 1
  197.     hilly(h) = 310
  198.     hillsz(h) = INT(RND * 5) + 1 + e / 1.5
  199.     hshape(h) = (RND - .35)
  200.     hcolor(h) = INT(RND * 100) + 100
  201. IF h = 0 THEN GOTO skiphill2:
  202. FOR hh = 1 TO h
  203.     IF speed2 > 0 THEN hilly(hh) = hilly(hh) + speed2 / 125
  204.     tilt5 = tilt / 5
  205.     IF tilt5 < 0 THEN tilt5 = -tilt5
  206.     hilly(hh) = hilly(hh) + tilt5 / 10
  207.     IF hilly(hh) > 650 THEN GOTO skiphill:
  208.     tttilt = tilt / 10
  209.     IF tttilt > 6 THEN tttilt = 6
  210.     IF tttilt < -6 THEN tttilt = -6
  211.     hillx(hh) = hillx(hh) + tttilt
  212.     FOR chilly = 0 TO 300
  213.         IF POINT(hillx(hh), hilly(hh)) = _RGB32(0, 0, chilly) THEN GOTO skiphill:
  214.     NEXT chilly
  215.     IF hillx(hh) < 0 OR hillx(hh) > 800 THEN GOTO skiphill:
  216.     FOR sz = .25 TO hillsz(hh) STEP .25
  217.         CIRCLE (hillx(hh), hilly(hh)), sz, _RGB32(hcolor(hh), hcolor(hh) + 44, 0), 2 * _PI, _PI, hshape(hh)
  218.     NEXT sz
  219.     skiphill:
  220. NEXT hh
  221. skiphill2:
  222.  
  223. _PRINTSTRING (250, 550), "Altitude"
  224. elevation$ = STR$(elevation)
  225. _PRINTSTRING (255, 570), elevation$
  226.  
  227. _PRINTSTRING (530, 550), "Airspeed"
  228. speed2 = INT(speed2)
  229. speed2$ = STR$(speed2)
  230. _PRINTSTRING (535, 570), speed2$
  231.  
  232. xx = 0: xx2 = 0: xx3 = 0
  233.  
  234.  

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Flight Simulator
« Reply #19 on: May 30, 2020, 12:54:02 am »
Sorry for so many updates, but I am trying to keep you all up to date as I make this better. It would be a good learning example for people.

V. 1.2 Update - Removed unneeded delay, lessened _LIMIT to 1000, made turning faster as you go faster, and increased speed to 2000.

Code: QB64: [Select]
  1. 'Flying - By SierraKen
  2. 'Made on May 29, 2020.
  3. 'V. 1.2 - Removed unneeded delay, lessened _LIMIT to 1000, made turning faster as you go faster, and increased speed to 2000.
  4.  
  5. DIM waterx(500), watery(500), shape(500), watersz(500)
  6. DIM hillx(500), hilly(500), hshape(500), hillsz(500), hcolor(500)
  7. DIM cloudx(500), cloudy(500), shapecl(500), cloudsz(500)
  8. SCREEN _NEWIMAGE(800, 600, 32)
  9. xs = 10
  10. c = 0
  11. e = 100
  12. d = 0
  13. FOR g = 1 TO 20
  14.     GOSUB grid:
  15.  
  16. _TITLE "Down arrow goes up. Up arrow goes down. + and - number pad keys are the accelerator. Left and Right keys turn."
  17.     _LIMIT 1000
  18.     a$ = INKEY$
  19.  
  20.     IF a$ = CHR$(0) + CHR$(72) THEN d = 6: e = e + .5: b = 0 'Up arrow key flies down.
  21.     IF a$ = CHR$(0) + CHR$(80) THEN d = 5: e = e - .5: b = 0 'Down arrow key flies up.
  22.     IF a$ = "+" THEN d = 1: speed2 = speed2 + 10
  23.     IF a$ = "-" THEN speed2 = speed2 - 10
  24.     IF speed2 <= 0 THEN speed = 0: b = 1: d = 0
  25.     IF a$ = CHR$(0) + CHR$(77) THEN d = 3: speed2 = speed2 + .2 'Right
  26.     IF a$ = CHR$(0) + CHR$(75) THEN d = 4: speed2 = speed2 + .2 'Left
  27.     IF a$ = CHR$(27) THEN END
  28.     IF d = 1 THEN speed = speed + 2: b = 0
  29.     IF d = 3 AND speed > 0 THEN
  30.         v = v - 1
  31.         vv = vv - 2
  32.         stilt = speed2 / 200
  33.         IF stilt < 4 THEN stilt = 4
  34.         tilt = tilt - stilt
  35.     END IF
  36.     IF d = 4 AND speed > 0 THEN
  37.         v = v + 1
  38.         vv = vv + 2
  39.         stilt2 = speed2 / 200
  40.         IF stilt2 < 4 THEN stilt2 = 4
  41.         tilt = tilt + stilt2
  42.     END IF
  43.     IF d = 3 AND speed <= 0 THEN
  44.         v = v - 1
  45.         vv = vv - 2
  46.         tilt = tilt - 3
  47.         speed = speed + 4
  48.     END IF
  49.     IF d = 4 AND speed <= 0 THEN
  50.         v = v + 1
  51.         vv = vv + 2
  52.         tilt = tilt + 3
  53.         speed = speed + 4
  54.     END IF
  55.     IF d = 5 OR speed2 > 0 THEN speed = speed + 1: b = 0
  56.     IF d = 6 OR speed2 > 0 THEN speed = speed + 1: b = 0
  57.  
  58.     IF tilt > 175 THEN tilt = 175
  59.     IF tilt < -175 THEN tilt = -175
  60.     IF (d = 3 OR d = 4 OR d = 5 OR d = 6) AND b = 0 THEN speed = speed + 1
  61.     IF (d = 3 OR d = 4) AND b = 1 THEN speed = speed - 1
  62.     IF e > 100 THEN e = 100
  63.     IF e < 0 THEN e = 0
  64.     elevation = e - 100
  65.     elevation = -elevation
  66.     elevation = elevation * 100
  67.     IF d <> 0 THEN GOSUB grid:
  68.     IF speed2 < 0 THEN speed2 = 0
  69.     IF speed2 > 2000 THEN speed2 = 2000
  70.  
  71. grid:
  72. FOR bsky = 0 TO 300 STEP .25
  73.     LINE (0, bsky - e - tilt)-(800, bsky - e + tilt), _RGB32(0, 0, bsky)
  74.     LINE (0, bsky - e - tilt + .125)-(800, bsky - e + tilt - .125), _RGB32(0, 0, bsky)
  75.     LINE (0, bsky - e - tilt - .125)-(800, bsky - e + tilt + .125), _RGB32(0, 0, bsky)
  76. NEXT bsky
  77.  
  78. FOR ground = 300 TO 900 STEP .25
  79.     IF ground = INT(ground) THEN ground2 = ground2 + 1
  80.     LINE (0, ground - e - tilt)-(800, ground - e + tilt), _RGB32(0, ground2, 0)
  81.     LINE (0, ground - e - tilt + .125)-(800, ground - e + tilt - .125), _RGB32(0, ground2, 0)
  82.     LINE (0, ground - e - tilt - .125)-(800, ground - e + tilt + .125), _RGB32(0, ground2, 0)
  83.  
  84. NEXT ground
  85. ground2 = 0
  86.  
  87. 'Calculate Compass
  88. tilt2 = tilt
  89. IF tilt2 < 0 THEN tilt2 = -tilt2
  90.  
  91. IF tilt < 0 THEN c = c - tilt2 / 314
  92. IF tilt > 0 THEN c = c + tilt2 / 314
  93. IF c > 359 THEN c = 0
  94. IF c < 0 THEN c = 359
  95. cc = INT(c)
  96. IF cc >= 340 OR cc < 25 THEN comp$ = "North"
  97. IF cc >= 25 AND cc < 65 THEN comp$ = "Northeast"
  98. IF cc >= 65 AND cc < 115 THEN comp$ = "East"
  99. IF cc >= 115 AND cc < 160 THEN comp$ = "Southeast"
  100. IF cc >= 160 AND cc < 205 THEN comp$ = "South"
  101. IF cc >= 205 AND cc < 250 THEN comp$ = "Southwest"
  102. IF cc >= 250 AND cc < 295 THEN comp$ = "West"
  103. IF cc >= 295 AND cc < 340 THEN comp$ = "Northwest"
  104. _PRINTSTRING (390, 550), comp$
  105. cc$ = STR$(cc)
  106. _PRINTSTRING (395, 570), cc$
  107.  
  108. 'Sun
  109. IF cc < 225 OR cc > 315 THEN til = 0: GOTO nosun:
  110. tilt3 = tilt / 50
  111. IF cc = 315 THEN sunx = 800
  112. IF cc = 225 THEN sunx = 0
  113. IF cc < 315 AND tilt < 0 AND tilt3 = oldtilt3 THEN sunx = sunx - 10: til = til - tilt3
  114. IF cc > 225 AND tilt > 0 AND tilt3 = oldtilt3 THEN sunx = sunx + 10: til = til + tilt3
  115. oldtilt3 = tilt3
  116. FOR sz = .25 TO 10 STEP .25
  117.     CIRCLE (sunx, til), sz, _RGB32(255, 255, 127)
  118. NEXT sz
  119. nosun:
  120.  
  121. 'Clouds
  122. clouds = INT(RND * 200) + 1
  123. IF clouds > 190 THEN
  124.     cl = cl + 1
  125.     IF cl > 100 THEN cl = 1
  126.     cloudx(cl) = INT(RND * 799) + 1
  127.     cloudy(cl) = 180
  128.     cloudsz(cl) = INT(RND * 5) + 1 + e / 1.5
  129.     IF cloudsz(cl) < 10 THEN cloudsz(cl) = 10
  130.     shapecl(cl) = (RND - .4)
  131.     IF shapecl(cl) < .4 THEN shapecl(cl) = .4
  132. IF cl = 0 THEN GOTO skipclouds2:
  133. FOR cl2 = 1 TO cl
  134.     cloudy(cl2) = cloudy(cl2) - speed2 / 125
  135.     tilt6 = tilt / 5
  136.     IF tilt6 < 0 THEN tilt6 = -tilt6
  137.     cloudy(cl2) = cloudy(cl2) + tilt6 / 10
  138.     IF cloudy(cl2) < -50 THEN GOTO skipclouds:
  139.     ttttilt = tilt / 10
  140.     IF ttttilt > 6 THEN ttttilt = 6
  141.     IF ttttilt < -6 THEN ttttilt = -6
  142.     cloudx(cl2) = cloudx(cl2) + ttttilt
  143.     IF cloudx(cl2) < -50 OR cloudx(cl2) > 850 THEN GOTO skipclouds:
  144.     IF cloudy(cl2) >= 175 THEN ccl = 100
  145.     IF cloudy(cl2) < 175 AND cloudy(cl2) >= 150 THEN ccl = 125
  146.     IF cloudy(cl2) < 150 AND cloudy(cl2) >= 125 THEN ccl = 150
  147.     IF cloudy(cl2) < 125 AND cloudy(cl2) >= 100 THEN ccl = 175
  148.     IF cloudy(cl2) < 100 AND cloudy(cl2) >= 75 THEN ccl = 200
  149.     IF cloudy(cl2) < 75 AND cloudy(cl2) >= 50 THEN ccl = 225
  150.     IF cloudy(cl2) < 50 THEN ccl = 255
  151.     FOR sz = .25 TO cloudsz(cl2) STEP .25
  152.         CIRCLE (cloudx(cl2), cloudy(cl2)), sz, _RGB32(ccl, ccl, ccl), , , shapecl(cl2)
  153.     NEXT sz
  154.     skipclouds:
  155. NEXT cl2
  156. skipclouds2:
  157.  
  158. 'Water
  159. water = INT(RND * 200) + 1
  160. IF water > 197 THEN
  161.     w = w + 1
  162.     IF w > 100 THEN w = 1
  163.     waterx(w) = INT(RND * 799) + 1
  164.     watery(w) = 310
  165.     watersz(w) = INT(RND * 5) + 1 + e / 1.5
  166.     shape(w) = (RND - .35)
  167. IF w = 0 THEN GOTO skipwater2:
  168. FOR ww = 1 TO w
  169.     watery(ww) = watery(ww) + speed2 / 125
  170.     tilt4 = tilt / 5
  171.     IF tilt4 < 0 THEN tilt4 = -tilt4
  172.     watery(ww) = watery(ww) + tilt4 / 10
  173.     IF watery(ww) > 650 THEN GOTO skipwater:
  174.     ttilt = tilt / 10
  175.     IF ttilt > 6 THEN ttilt = 6
  176.     IF ttilt < -6 THEN ttilt = -6
  177.     waterx(ww) = waterx(ww) + ttilt
  178.     FOR chilly = 0 TO 300
  179.         IF POINT(hillx(hh), hilly(hh)) = _RGB32(0, 0, chilly) THEN GOTO skipwater:
  180.     NEXT chilly
  181.     IF waterx(ww) < -50 OR waterx(ww) > 850 THEN GOTO skipwater:
  182.     FOR sz = .25 TO watersz(ww) STEP .25
  183.         CIRCLE (waterx(ww), watery(ww)), sz, _RGB32(100, 100, 255), , , shape(ww)
  184.     NEXT sz
  185.     skipwater:
  186. NEXT ww
  187. skipwater2:
  188.  
  189. 'Hills
  190. hills = INT(RND * 200) + 1
  191. IF hills > 150 THEN
  192.     h = h + 1
  193.     IF h > 300 THEN h = 1
  194.     hillx(h) = INT(RND * 799) + 1
  195.     hilly(h) = 310
  196.     hillsz(h) = INT(RND * 5) + 1 + e / 1.5
  197.     hshape(h) = (RND - .35)
  198.     hcolor(h) = INT(RND * 100) + 100
  199. IF h = 0 THEN GOTO skiphill2:
  200. FOR hh = 1 TO h
  201.     IF speed2 > 0 THEN hilly(hh) = hilly(hh) + speed2 / 125
  202.     tilt5 = tilt / 5
  203.     IF tilt5 < 0 THEN tilt5 = -tilt5
  204.     hilly(hh) = hilly(hh) + tilt5 / 10
  205.     IF hilly(hh) > 650 THEN GOTO skiphill:
  206.     tttilt = tilt / 10
  207.     IF tttilt > 6 THEN tttilt = 6
  208.     IF tttilt < -6 THEN tttilt = -6
  209.     hillx(hh) = hillx(hh) + tttilt
  210.     FOR chilly = 0 TO 300
  211.         IF POINT(hillx(hh), hilly(hh)) = _RGB32(0, 0, chilly) THEN GOTO skiphill:
  212.     NEXT chilly
  213.     IF hillx(hh) < 0 OR hillx(hh) > 800 THEN GOTO skiphill:
  214.     FOR sz = .25 TO hillsz(hh) STEP .25
  215.         CIRCLE (hillx(hh), hilly(hh)), sz, _RGB32(hcolor(hh), hcolor(hh) + 44, 0), 2 * _PI, _PI, hshape(hh)
  216.     NEXT sz
  217.     skiphill:
  218. NEXT hh
  219. skiphill2:
  220.  
  221. _PRINTSTRING (250, 550), "Altitude"
  222. elevation$ = STR$(elevation)
  223. _PRINTSTRING (255, 570), elevation$
  224.  
  225. _PRINTSTRING (530, 550), "Airspeed"
  226. speed2 = INT(speed2)
  227. speed2$ = STR$(speed2)
  228. _PRINTSTRING (535, 570), speed2$
  229.  
  230. xx = 0: xx2 = 0: xx3 = 0
  231.  
  232.  
« Last Edit: May 30, 2020, 01:12:36 am by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Flight Simulator
« Reply #20 on: May 30, 2020, 05:05:31 pm »
Today I added buildings with windows, made a lot more hills, and fixed the water.
Also attached is a picture of the current version.

Code: QB64: [Select]
  1. 'Flying - By SierraKen
  2. 'Made on May 30, 2020.
  3. 'V. 1.3 - Fixed water, added more hills, added buildings.
  4.  
  5. DIM waterx(500), watery(500), shape(500), watersz(500)
  6. DIM hillx(40000), hilly(40000), hshape(40000), hillsz(40000), hcolor(40000)
  7. DIM cloudx(500), cloudy(500), shapecl(500), cloudsz(500)
  8. DIM buildingx(600), buildingy(600), buildingsz1(600), buildingsz2(600), bcolor(600)
  9. SCREEN _NEWIMAGE(800, 600, 32)
  10. xs = 10
  11. c = 0
  12. e = 100
  13. d = 0
  14. FOR g = 1 TO 20
  15.     GOSUB grid:
  16.  
  17. _TITLE "Down arrow goes up. Up arrow goes down. + and - number pad keys are the accelerator. Left and Right keys turn."
  18.     _LIMIT 2000
  19.     a$ = INKEY$
  20.  
  21.     IF a$ = CHR$(0) + CHR$(72) THEN d = 6: e = e + .5: b2 = 0 'Up arrow key flies down.
  22.     IF a$ = CHR$(0) + CHR$(80) THEN d = 5: e = e - .5: b2 = 0 'Down arrow key flies up.
  23.     IF a$ = "+" THEN d = 1: speed2 = speed2 + 10
  24.     IF a$ = "-" THEN speed2 = speed2 - 10
  25.     IF speed2 <= 0 THEN speed = 0: b2 = 1: d = 0
  26.     IF a$ = CHR$(0) + CHR$(77) THEN d = 3: speed2 = speed2 + .2 'Right
  27.     IF a$ = CHR$(0) + CHR$(75) THEN d = 4: speed2 = speed2 + .2 'Left
  28.     IF a$ = CHR$(27) THEN END
  29.     IF d = 1 THEN speed = speed + 2: b2 = 0
  30.     IF d = 3 AND speed > 0 THEN
  31.         v = v - 1
  32.         vv = vv - 2
  33.         stilt = speed2 / 200
  34.         IF stilt < 4 THEN stilt = 4
  35.         tilt = tilt - stilt
  36.     END IF
  37.     IF d = 4 AND speed > 0 THEN
  38.         v = v + 1
  39.         vv = vv + 2
  40.         stilt2 = speed2 / 200
  41.         IF stilt2 < 4 THEN stilt2 = 4
  42.         tilt = tilt + stilt2
  43.     END IF
  44.     IF d = 3 AND speed <= 0 THEN
  45.         v = v - 1
  46.         vv = vv - 2
  47.         tilt = tilt - 3
  48.         speed = speed + 4
  49.     END IF
  50.     IF d = 4 AND speed <= 0 THEN
  51.         v = v + 1
  52.         vv = vv + 2
  53.         tilt = tilt + 3
  54.         speed = speed + 4
  55.     END IF
  56.     IF d = 5 OR speed2 > 0 THEN speed = speed + 1: b2 = 0
  57.     IF d = 6 OR speed2 > 0 THEN speed = speed + 1: b2 = 0
  58.  
  59.     IF tilt > 175 THEN tilt = 175
  60.     IF tilt < -175 THEN tilt = -175
  61.     IF (d = 3 OR d = 4 OR d = 5 OR d = 6) AND b2 = 0 THEN speed = speed + 1
  62.     IF (d = 3 OR d = 4) AND b2 = 1 THEN speed = speed - 1
  63.     IF e > 100 THEN e = 100
  64.     IF e < 0 THEN e = 0
  65.     elevation = e - 100
  66.     elevation = -elevation
  67.     elevation = elevation * 100
  68.     IF d <> 0 THEN GOSUB grid:
  69.     IF speed2 < 0 THEN speed2 = 0
  70.     IF speed2 > 2000 THEN speed2 = 2000
  71.  
  72. grid:
  73. FOR bsky = 0 TO 300 STEP .25
  74.     LINE (0, bsky - e - tilt)-(800, bsky - e + tilt), _RGB32(0, 0, bsky)
  75.     LINE (0, bsky - e - tilt + .125)-(800, bsky - e + tilt - .125), _RGB32(0, 0, bsky)
  76.     LINE (0, bsky - e - tilt - .125)-(800, bsky - e + tilt + .125), _RGB32(0, 0, bsky)
  77. NEXT bsky
  78.  
  79. FOR ground = 300 TO 900 STEP .25
  80.     IF ground = INT(ground) THEN ground2 = ground2 + 1
  81.     LINE (0, ground - e - tilt)-(800, ground - e + tilt), _RGB32(0, ground2, 0)
  82.     LINE (0, ground - e - tilt + .125)-(800, ground - e + tilt - .125), _RGB32(0, ground2, 0)
  83.     LINE (0, ground - e - tilt - .125)-(800, ground - e + tilt + .125), _RGB32(0, ground2, 0)
  84.  
  85. NEXT ground
  86. ground2 = 0
  87.  
  88. 'Calculate Compass
  89. tilt2 = tilt
  90. IF tilt2 < 0 THEN tilt2 = -tilt2
  91.  
  92. IF tilt < 0 THEN c = c - tilt2 / 314
  93. IF tilt > 0 THEN c = c + tilt2 / 314
  94. IF c > 359 THEN c = 0
  95. IF c < 0 THEN c = 359
  96. cc = INT(c)
  97. IF cc >= 340 OR cc < 25 THEN comp$ = "North"
  98. IF cc >= 25 AND cc < 65 THEN comp$ = "Northeast"
  99. IF cc >= 65 AND cc < 115 THEN comp$ = "East"
  100. IF cc >= 115 AND cc < 160 THEN comp$ = "Southeast"
  101. IF cc >= 160 AND cc < 205 THEN comp$ = "South"
  102. IF cc >= 205 AND cc < 250 THEN comp$ = "Southwest"
  103. IF cc >= 250 AND cc < 295 THEN comp$ = "West"
  104. IF cc >= 295 AND cc < 340 THEN comp$ = "Northwest"
  105. _PRINTSTRING (390, 550), comp$
  106. cc$ = STR$(cc)
  107. _PRINTSTRING (395, 570), cc$
  108.  
  109.  
  110. 'Sun
  111. IF cc < 225 OR cc > 315 THEN til = 0: GOTO nosun:
  112. tilt3 = tilt / 50
  113. IF cc = 315 THEN sunx = 800
  114. IF cc = 225 THEN sunx = 0
  115. IF cc < 315 AND tilt < 0 AND tilt3 = oldtilt3 THEN sunx = sunx - 10: til = til - tilt3
  116. IF cc > 225 AND tilt > 0 AND tilt3 = oldtilt3 THEN sunx = sunx + 10: til = til + tilt3
  117. oldtilt3 = tilt3
  118. FOR sz = .25 TO 10 STEP .25
  119.     CIRCLE (sunx, til), sz, _RGB32(255, 255, 127)
  120. NEXT sz
  121. nosun:
  122.  
  123. 'Clouds
  124. clouds = INT(RND * 200) + 1
  125. IF clouds > 190 THEN
  126.     cl = cl + 1
  127.     IF cl > 100 THEN cl = 1
  128.     cloudx(cl) = INT(RND * 799) + 1
  129.     cloudy(cl) = 180
  130.     cloudsz(cl) = INT(RND * 5) + 1 + e / 1.5
  131.     IF cloudsz(cl) < 10 THEN cloudsz(cl) = 10
  132.     shapecl(cl) = (RND - .4)
  133.     IF shapecl(cl) < .4 THEN shapecl(cl) = .4
  134. IF cl = 0 THEN GOTO skipclouds2:
  135. FOR cl2 = 1 TO cl
  136.     cloudy(cl2) = cloudy(cl2) - speed2 / 125
  137.     tilt6 = tilt / 5
  138.     IF tilt6 < 0 THEN tilt6 = -tilt6
  139.     cloudy(cl2) = cloudy(cl2) + tilt6 / 10
  140.     IF cloudy(cl2) < -50 THEN GOTO skipclouds:
  141.     ttttilt = tilt / 10
  142.     IF ttttilt > 6 THEN ttttilt = 6
  143.     IF ttttilt < -6 THEN ttttilt = -6
  144.     cloudx(cl2) = cloudx(cl2) + ttttilt
  145.     IF cloudx(cl2) < -50 OR cloudx(cl2) > 850 THEN GOTO skipclouds:
  146.     IF cloudy(cl2) >= 175 THEN ccl = 100
  147.     IF cloudy(cl2) < 175 AND cloudy(cl2) >= 150 THEN ccl = 125
  148.     IF cloudy(cl2) < 150 AND cloudy(cl2) >= 125 THEN ccl = 150
  149.     IF cloudy(cl2) < 125 AND cloudy(cl2) >= 100 THEN ccl = 175
  150.     IF cloudy(cl2) < 100 AND cloudy(cl2) >= 75 THEN ccl = 200
  151.     IF cloudy(cl2) < 75 AND cloudy(cl2) >= 50 THEN ccl = 225
  152.     IF cloudy(cl2) < 50 THEN ccl = 255
  153.     FOR sz = .25 TO cloudsz(cl2) STEP .25
  154.         CIRCLE (cloudx(cl2), cloudy(cl2)), sz, _RGB32(ccl, ccl, ccl), , , shapecl(cl2)
  155.     NEXT sz
  156.     skipclouds:
  157. NEXT cl2
  158. skipclouds2:
  159.  
  160. 'Water
  161. water = INT(RND * 200) + 1
  162. IF water > 190 THEN
  163.     w = w + 1
  164.     IF w > 100 THEN w = 1
  165.     waterx(w) = INT(RND * 799) + 1
  166.     watery(w) = 310
  167.     watersz(w) = INT(RND * 5) + 1 + e / 1.5
  168.     shape(w) = (RND - .35)
  169.     IF shape(w) < .1 THEN shape(w) = .1
  170. IF w = 0 THEN GOTO skipwater2:
  171. FOR ww = 1 TO w
  172.     watery(ww) = watery(ww) + speed2 / 125
  173.     tilt4 = tilt / 5
  174.     IF tilt4 < 0 THEN tilt4 = -tilt4
  175.     watery(ww) = watery(ww) + tilt4 / 10
  176.     IF watery(ww) > 650 THEN GOTO skipwater:
  177.     ttilt = tilt / 10
  178.     IF ttilt > 6 THEN ttilt = 6
  179.     IF ttilt < -6 THEN ttilt = -6
  180.     waterx(ww) = waterx(ww) + ttilt
  181.     IF waterx(ww) < -50 OR waterx(ww) > 850 THEN GOTO skipwater:
  182.     FOR sz = .25 TO watersz(ww) STEP .25
  183.         CIRCLE (waterx(ww), watery(ww)), sz, _RGB32(100, 100, 255), , , shape(ww)
  184.     NEXT sz
  185.     skipwater:
  186. NEXT ww
  187. skipwater2:
  188.  
  189. 'Hills
  190. hills = INT(RND * 1000) + 1
  191. IF speed2 > hills THEN
  192.     h = h + 1
  193.     IF h > 30000 THEN h = 1
  194.     hillx(h) = INT(RND * 799) + 1
  195.     hilly(h) = 310
  196.     hillsz(h) = INT(RND * 5) + 1 + e / 1.5
  197.     hshape(h) = (RND - .35)
  198.     hcolor(h) = INT(RND * 100) + 100
  199. IF h = 0 THEN GOTO skiphill2:
  200. FOR hh = 1 TO h
  201.     IF speed2 > 0 THEN hilly(hh) = hilly(hh) + speed2 / 125
  202.     tilt5 = tilt / 5
  203.     IF tilt5 < 0 THEN tilt5 = -tilt5
  204.     hilly(hh) = hilly(hh) + tilt5 / 10
  205.     IF hilly(hh) > 650 THEN GOTO skiphill:
  206.     tttilt = tilt / 10
  207.     IF tttilt > 6 THEN tttilt = 6
  208.     IF tttilt < -6 THEN tttilt = -6
  209.     hillx(hh) = hillx(hh) + tttilt
  210.     FOR chilly = 0 TO 300
  211.         IF POINT(hillx(hh), hilly(hh)) = _RGB32(0, 0, chilly) THEN GOTO skiphill:
  212.     NEXT chilly
  213.     IF hillx(hh) < 0 OR hillx(hh) > 800 THEN GOTO skiphill:
  214.     FOR sz = .25 TO hillsz(hh) STEP .25
  215.         CIRCLE (hillx(hh), hilly(hh)), sz, _RGB32(hcolor(hh), hcolor(hh) + 44, 0), 2 * _PI, _PI, hshape(hh)
  216.     NEXT sz
  217.     skiphill:
  218. NEXT hh
  219. skiphill2:
  220.  
  221. 'Buildings
  222. building = INT(RND * 200) + 1
  223. IF building > 190 THEN
  224.     b = b + 1
  225.     IF b > 500 THEN b = 1
  226.     buildingx(b) = INT(RND * 799) + 1
  227.     buildingy(b) = 310
  228.     buildingsz1(b) = INT(RND * 2) + 1 + e / 4.5
  229.     buildingsz2(b) = INT(RND * 2) + 1 + e / 4.5
  230.     bcolor(b) = INT(RND * 155) + 100
  231. IF b = 0 THEN GOTO skipbuilding2:
  232. FOR bb = 1 TO b
  233.     buildingy(bb) = buildingy(bb) + speed2 / 125
  234.     tilt7 = tilt / 5
  235.     IF tilt7 < 0 THEN tilt7 = -tilt7
  236.     buildingy(bb) = buildingy(bb) + tilt7 / 10
  237.     IF buildingy(bb) > 650 THEN GOTO skipbuilding:
  238.     tttttilt = tilt / 10
  239.     IF tttttilt > 6 THEN tttttilt = 6
  240.     IF tttttilt < -6 THEN tttttilt = -6
  241.     buildingx(bb) = buildingx(bb) + tttttilt
  242.     IF buildingx(bb) < -50 OR buildingx(bb) > 850 THEN GOTO skipbuilding:
  243.     LINE (buildingx(bb), buildingy(bb))-(buildingx(bb) + buildingsz1(bb), buildingy(bb) + buildingsz2(bb)), _RGB32(150, bcolor(bb), bcolor(bb)), BF
  244.  
  245.     'Building Windows
  246.     IF elevation <= 1000 THEN ew = 2
  247.     IF elevation > 1000 AND elevation < 2000 THEN ew = 1
  248.     IF elevation >= 2000 THEN GOTO skipwindows:
  249.  
  250.     bwindowx1 = (buildingx(bb) + buildingsz1(bb)) - 5
  251.     bwindowy1 = (buildingy(bb) + buildingsz2(bb)) - 5
  252.     bwindowx2 = (buildingx(bb) + buildingsz1(bb)) - 10
  253.     bwindowy2 = (buildingy(bb) + buildingsz2(bb)) - 5
  254.     bwindowx3 = (buildingx(bb) + buildingsz1(bb)) - 15
  255.     bwindowy3 = (buildingy(bb) + buildingsz2(bb)) - 5
  256.     bwindowx4 = (buildingx(bb) + buildingsz1(bb)) - 20
  257.     bwindowy4 = (buildingy(bb) + buildingsz2(bb)) - 5
  258.     bwindowx5 = (buildingx(bb) + buildingsz1(bb)) - 5
  259.     bwindowy5 = (buildingy(bb) + buildingsz2(bb)) - 10
  260.     bwindowx6 = (buildingx(bb) + buildingsz1(bb)) - 10
  261.     bwindowy6 = (buildingy(bb) + buildingsz2(bb)) - 10
  262.     bwindowx7 = (buildingx(bb) + buildingsz1(bb)) - 15
  263.     bwindowy7 = (buildingy(bb) + buildingsz2(bb)) - 10
  264.     bwindowx8 = (buildingx(bb) + buildingsz1(bb)) - 20
  265.     bwindowy8 = (buildingy(bb) + buildingsz2(bb)) - 10
  266.     bwindowx9 = (buildingx(bb) + buildingsz1(bb)) - 5
  267.     bwindowy9 = (buildingy(bb) + buildingsz2(bb)) - 15
  268.     bwindowx10 = (buildingx(bb) + buildingsz1(bb)) - 10
  269.     bwindowy10 = (buildingy(bb) + buildingsz2(bb)) - 15
  270.     bwindowx11 = (buildingx(bb) + buildingsz1(bb)) - 15
  271.     bwindowy11 = (buildingy(bb) + buildingsz2(bb)) - 15
  272.     bwindowx12 = (buildingx(bb) + buildingsz1(bb)) - 20
  273.     bwindowy12 = (buildingy(bb) + buildingsz2(bb)) - 15
  274.     bwindowx13 = (buildingx(bb) + buildingsz1(bb)) - 5
  275.     bwindowy13 = (buildingy(bb) + buildingsz2(bb)) - 20
  276.     bwindowx14 = (buildingx(bb) + buildingsz1(bb)) - 10
  277.     bwindowy14 = (buildingy(bb) + buildingsz2(bb)) - 20
  278.     bwindowx15 = (buildingx(bb) + buildingsz1(bb)) - 15
  279.     bwindowy15 = (buildingy(bb) + buildingsz2(bb)) - 20
  280.     bwindowx16 = (buildingx(bb) + buildingsz1(bb)) - 20
  281.     bwindowy16 = (buildingy(bb) + buildingsz2(bb)) - 20
  282.  
  283.     LINE (bwindowx1, bwindowy1)-(bwindowx1 + ew, bwindowy1 + ew), _RGB32(255, 255, 255), BF
  284.     LINE (bwindowx2, bwindowy2)-(bwindowx2 + ew, bwindowy2 + ew), _RGB32(255, 255, 255), BF
  285.     LINE (bwindowx3, bwindowy3)-(bwindowx3 + ew, bwindowy3 + ew), _RGB32(255, 255, 255), BF
  286.     LINE (bwindowx4, bwindowy4)-(bwindowx4 + ew, bwindowy4 + ew), _RGB32(255, 255, 255), BF
  287.     LINE (bwindowx5, bwindowy5)-(bwindowx5 + ew, bwindowy5 + ew), _RGB32(255, 255, 255), BF
  288.     LINE (bwindowx6, bwindowy6)-(bwindowx6 + ew, bwindowy6 + ew), _RGB32(255, 255, 255), BF
  289.     LINE (bwindowx7, bwindowy7)-(bwindowx7 + ew, bwindowy7 + ew), _RGB32(255, 255, 255), BF
  290.     LINE (bwindowx8, bwindowy8)-(bwindowx8 + ew, bwindowy8 + ew), _RGB32(255, 255, 255), BF
  291.     LINE (bwindowx9, bwindowy9)-(bwindowx9 + ew, bwindowy9 + ew), _RGB32(255, 255, 255), BF
  292.     LINE (bwindowx10, bwindowy10)-(bwindowx10 + ew, bwindowy10 + ew), _RGB32(255, 255, 255), BF
  293.     LINE (bwindowx11, bwindowy11)-(bwindowx11 + ew, bwindowy11 + ew), _RGB32(255, 255, 255), BF
  294.     LINE (bwindowx12, bwindowy12)-(bwindowx12 + ew, bwindowy12 + ew), _RGB32(255, 255, 255), BF
  295.     LINE (bwindowx13, bwindowy13)-(bwindowx13 + ew, bwindowy13 + ew), _RGB32(255, 255, 255), BF
  296.     LINE (bwindowx14, bwindowy14)-(bwindowx14 + ew, bwindowy14 + ew), _RGB32(255, 255, 255), BF
  297.     LINE (bwindowx15, bwindowy15)-(bwindowx15 + ew, bwindowy15 + ew), _RGB32(255, 255, 255), BF
  298.     LINE (bwindowx16, bwindowy16)-(bwindowx16 + ew, bwindowy16 + ew), _RGB32(255, 255, 255), BF
  299.     skipwindows:
  300.     skipbuilding:
  301. NEXT bb
  302. skipbuilding2:
  303.  
  304. _PRINTSTRING (250, 550), "Altitude"
  305. elevation$ = STR$(elevation)
  306. _PRINTSTRING (255, 570), elevation$
  307.  
  308. _PRINTSTRING (530, 550), "Airspeed"
  309. speed2 = INT(speed2)
  310. speed2$ = STR$(speed2)
  311. _PRINTSTRING (535, 570), speed2$
  312.  
  313. xx = 0: xx2 = 0: xx3 = 0
  314.  
  315.  

Flight Simulator by Ken - May 30 2020.jpg
* Flight Simulator by Ken - May 30 2020.jpg (Filesize: 88.75 KB, Dimensions: 801x624, Views: 151)

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Flight Simulator
« Reply #21 on: May 31, 2020, 05:47:42 pm »
Yep, I'm still working on it. :) Something I've wanted to make all my life so I'm trying to make it as good as I can get.

V. 1.4 - Increased size of hills and made them not able to overlap, fixed display of compass, fixed Sun so it won't show up underground, increased speed.   

Code: QB64: [Select]
  1. 'Flying - By SierraKen
  2. 'Made on May 31, 2020.
  3. 'V. 1.4 - Increased size of hills and made them not able to overlap, fixed display of compass, fixed Sun so it won't show up underground, increased speed.
  4.  
  5. DIM waterx(500), watery(500), shape(500), watersz(500)
  6. DIM hillx(40000), hilly(40000), hshape(40000), hillsz(40000), hcolor(40000)
  7. DIM cloudx(500), cloudy(500), shapecl(500), cloudsz(500)
  8. DIM buildingx(600), buildingy(600), buildingsz1(600), buildingsz2(600), bcolor(600)
  9. SCREEN _NEWIMAGE(800, 600, 32)
  10. xs = 10
  11. c = 0
  12. e = 100
  13. d = 0
  14. FOR g = 1 TO 20
  15.     GOSUB grid:
  16.  
  17. _TITLE "Down arrow goes up. Up arrow goes down. + and - number pad keys are the accelerator. Left and Right keys turn."
  18.     _LIMIT 2000
  19.     a$ = INKEY$
  20.  
  21.     IF a$ = CHR$(0) + CHR$(72) THEN d = 6: e = e + .5: b2 = 0 'Up arrow key flies down.
  22.     IF a$ = CHR$(0) + CHR$(80) THEN d = 5: e = e - .5: b2 = 0 'Down arrow key flies up.
  23.     IF a$ = "+" THEN d = 1: speed2 = speed2 + 10
  24.     IF a$ = "-" THEN speed2 = speed2 - 10
  25.     IF speed2 <= 0 THEN speed = 0: b2 = 1: d = 0
  26.     IF a$ = CHR$(0) + CHR$(77) THEN d = 3: speed2 = speed2 + .2 'Right
  27.     IF a$ = CHR$(0) + CHR$(75) THEN d = 4: speed2 = speed2 + .2 'Left
  28.     IF a$ = CHR$(27) THEN END
  29.     IF d = 1 THEN speed = speed + 8: b2 = 0
  30.     IF d = 3 AND speed > 0 THEN
  31.         v = v - 1
  32.         vv = vv - 2
  33.         stilt = speed2 / 100
  34.         IF stilt < 8 THEN stilt = 8
  35.         tilt = tilt - stilt
  36.     END IF
  37.     IF d = 4 AND speed > 0 THEN
  38.         v = v + 1
  39.         vv = vv + 2
  40.         stilt2 = speed2 / 100
  41.         IF stilt2 < 8 THEN stilt2 = 8
  42.         tilt = tilt + stilt2
  43.     END IF
  44.     IF d = 3 AND speed <= 0 THEN
  45.         v = v - 1
  46.         vv = vv - 2
  47.         tilt = tilt - 3
  48.         speed = speed + 4
  49.     END IF
  50.     IF d = 4 AND speed <= 0 THEN
  51.         v = v + 1
  52.         vv = vv + 2
  53.         tilt = tilt + 3
  54.         speed = speed + 4
  55.     END IF
  56.     IF d = 5 OR speed2 > 0 THEN speed = speed + 1: b2 = 0
  57.     IF d = 6 OR speed2 > 0 THEN speed = speed + 1: b2 = 0
  58.  
  59.     IF tilt > 175 THEN tilt = 175
  60.     IF tilt < -175 THEN tilt = -175
  61.     IF (d = 3 OR d = 4 OR d = 5 OR d = 6) AND b2 = 0 THEN speed = speed + 1
  62.     IF (d = 3 OR d = 4) AND b2 = 1 THEN speed = speed - 1
  63.     IF e > 100 THEN e = 100
  64.     IF e < 0 THEN e = 0
  65.     elevation = e - 100
  66.     elevation = -elevation
  67.     elevation = elevation * 100
  68.     IF d <> 0 THEN GOSUB grid:
  69.     IF speed2 < 0 THEN speed2 = 0
  70.     IF speed2 > 2000 THEN speed2 = 2000
  71.  
  72. grid:
  73. FOR bsky = 0 TO 300 STEP .25
  74.     LINE (0, bsky - e - tilt)-(800, bsky - e + tilt), _RGB32(0, 0, bsky)
  75.     LINE (0, bsky - e - tilt + .125)-(800, bsky - e + tilt - .125), _RGB32(0, 0, bsky)
  76.     LINE (0, bsky - e - tilt - .125)-(800, bsky - e + tilt + .125), _RGB32(0, 0, bsky)
  77. NEXT bsky
  78.  
  79. FOR ground = 300 TO 900 STEP .25
  80.     IF ground = INT(ground) THEN ground2 = ground2 + 1
  81.     LINE (0, ground - e - tilt)-(800, ground - e + tilt), _RGB32(0, ground2, 0)
  82.     LINE (0, ground - e - tilt + .125)-(800, ground - e + tilt - .125), _RGB32(0, ground2, 0)
  83.     LINE (0, ground - e - tilt - .125)-(800, ground - e + tilt + .125), _RGB32(0, ground2, 0)
  84.  
  85. NEXT ground
  86. ground2 = 0
  87.  
  88. 'Sun
  89. IF cc < 225 OR cc > 315 THEN til = 0: GOTO nosun:
  90. tilt3 = tilt / 50
  91. IF cc = 315 THEN sunx = 800
  92. IF cc = 225 THEN sunx = 0
  93. oldtil = til
  94. IF cc < 315 AND tilt < 0 AND tilt3 = oldtilt3 THEN sunx = sunx - 10: til = til - tilt3
  95. IF cc > 225 AND tilt > 0 AND tilt3 = oldtilt3 THEN sunx = sunx + 10: til = til + tilt3
  96. oldtilt3 = tilt3
  97. FOR chk = 1 TO 255
  98.     IF POINT(sunx, til) = _RGB32(0, chk, 0) THEN
  99.         GOTO nosun:
  100.     END IF
  101. NEXT chk
  102. sun:
  103. FOR sz = .25 TO 10 STEP .25
  104.     CIRCLE (sunx, til), sz, _RGB32(255, 255, 127)
  105. NEXT sz
  106. nosun:
  107.  
  108. 'Clouds
  109. clouds = INT(RND * 200) + 1
  110. IF clouds > 190 THEN
  111.     cl = cl + 1
  112.     IF cl > 100 THEN cl = 1
  113.     cloudx(cl) = INT(RND * 799) + 1
  114.     cloudy(cl) = 180
  115.     cloudsz(cl) = INT(RND * 5) + 1 + e / 1.5
  116.     IF cloudsz(cl) < 10 THEN cloudsz(cl) = 10
  117.     shapecl(cl) = (RND - .4)
  118.     IF shapecl(cl) < .4 THEN shapecl(cl) = .4
  119. IF cl = 0 THEN GOTO skipclouds2:
  120. FOR cl2 = 1 TO cl
  121.     cloudy(cl2) = cloudy(cl2) - speed2 / 60
  122.     tilt6 = tilt / 5
  123.     IF tilt6 < 0 THEN tilt6 = -tilt6
  124.     cloudy(cl2) = cloudy(cl2) + tilt6 / 10
  125.     IF cloudy(cl2) < -50 THEN GOTO skipclouds:
  126.     ttttilt = tilt / 10
  127.     IF ttttilt > 6 THEN ttttilt = 6
  128.     IF ttttilt < -6 THEN ttttilt = -6
  129.     cloudx(cl2) = cloudx(cl2) + ttttilt
  130.     IF cloudx(cl2) < -50 OR cloudx(cl2) > 850 THEN GOTO skipclouds:
  131.     IF cloudy(cl2) >= 175 THEN ccl = 100
  132.     IF cloudy(cl2) < 175 AND cloudy(cl2) >= 150 THEN ccl = 125
  133.     IF cloudy(cl2) < 150 AND cloudy(cl2) >= 125 THEN ccl = 150
  134.     IF cloudy(cl2) < 125 AND cloudy(cl2) >= 100 THEN ccl = 175
  135.     IF cloudy(cl2) < 100 AND cloudy(cl2) >= 75 THEN ccl = 200
  136.     IF cloudy(cl2) < 75 AND cloudy(cl2) >= 50 THEN ccl = 225
  137.     IF cloudy(cl2) < 50 THEN ccl = 255
  138.     FOR sz = .25 TO cloudsz(cl2) STEP .25
  139.         CIRCLE (cloudx(cl2), cloudy(cl2)), sz, _RGB32(ccl, ccl, ccl), , , shapecl(cl2)
  140.     NEXT sz
  141.     skipclouds:
  142. NEXT cl2
  143. skipclouds2:
  144.  
  145. 'Water
  146. water = INT(RND * 200) + 1
  147. IF water > 190 THEN
  148.     w = w + 1
  149.     IF w > 100 THEN w = 1
  150.     waterx(w) = INT(RND * 799) + 1
  151.     watery(w) = 310
  152.     watersz(w) = INT(RND * 5) + 1 + e / 1.5
  153.     shape(w) = (RND - .35)
  154.     IF shape(w) < .1 THEN shape(w) = .1
  155. IF w = 0 THEN GOTO skipwater2:
  156. FOR ww = 1 TO w
  157.     watery(ww) = watery(ww) + speed2 / 60
  158.     tilt4 = tilt / 5
  159.     IF tilt4 < 0 THEN tilt4 = -tilt4
  160.     watery(ww) = watery(ww) + tilt4 / 10
  161.     IF watery(ww) > 650 THEN GOTO skipwater:
  162.     ttilt = tilt / 10
  163.     IF ttilt > 6 THEN ttilt = 6
  164.     IF ttilt < -6 THEN ttilt = -6
  165.     waterx(ww) = waterx(ww) + ttilt
  166.     IF waterx(ww) < -50 OR waterx(ww) > 850 THEN GOTO skipwater:
  167.     FOR sz = .25 TO watersz(ww) STEP .25
  168.         CIRCLE (waterx(ww), watery(ww)), sz, _RGB32(100, 100, 255), , , shape(ww)
  169.     NEXT sz
  170.     skipwater:
  171. NEXT ww
  172. skipwater2:
  173.  
  174. 'Hills
  175. hlls = INT(RND * 200) + 1
  176. IF hlls < 180 THEN GOTO hills:
  177.  
  178. hills = INT(RND * 1000) + 1
  179. IF speed2 > hills THEN
  180.     h = h + 1
  181.     IF h > 30000 THEN h = 1
  182.     hillx(h) = INT(RND * 799) + 1
  183.     hilly(h) = 310
  184.     hillsz(h) = INT(RND * e) + 50 + e / 1.5
  185.     hshape(h) = (RND - .35)
  186.     hcolor(h) = INT(RND * 100) + 100
  187. hills:
  188. IF h = 0 THEN GOTO skiphill2:
  189. FOR hh = 1 TO h
  190.     IF speed2 > 0 THEN hilly(hh) = hilly(hh) + speed2 / 60
  191.     tilt5 = tilt / 5
  192.     IF tilt5 < 0 THEN tilt5 = -tilt5
  193.     hilly(hh) = hilly(hh) + tilt5 / 10
  194.     IF hilly(hh) > 650 THEN GOTO skiphill:
  195.     tttilt = tilt / 10
  196.     IF tttilt > 6 THEN tttilt = 6
  197.     IF tttilt < -6 THEN tttilt = -6
  198.     hillx(hh) = hillx(hh) + tttilt
  199.     FOR chilly = 0 TO 300
  200.         IF POINT(hillx(hh), hilly(hh)) = _RGB32(0, 0, chilly) THEN GOTO skiphill:
  201.     NEXT chilly
  202.     FOR hcolor2 = 100 TO 200
  203.         FOR hx = -hillsz(hh) TO hillsz(hh)
  204.             IF POINT(hillx(hh) + hx, hilly(hh)) = _RGB32(hcolor2, hcolor2 + 44, 0) THEN GOTO skiphill:
  205.             IF POINT(hillx(hh), hilly(hh) - hx) = _RGB32(hcolor2, hcolor2 + 44, 0) THEN GOTO skiphill:
  206.         NEXT hx
  207.     NEXT hcolor2
  208.     IF hillx(hh) < 0 OR hillx(hh) > 800 THEN GOTO skiphill:
  209.     FOR sz = .25 TO hillsz(hh) STEP .25
  210.         CIRCLE (hillx(hh), hilly(hh)), sz, _RGB32(hcolor(hh), hcolor(hh) + 44, 0), 2 * _PI, _PI, hshape(hh)
  211.     NEXT sz
  212.     skiphill:
  213. NEXT hh
  214. skiphill2:
  215.  
  216. 'Buildings
  217. building = INT(RND * 200) + 1
  218. IF building > 190 THEN
  219.     b = b + 1
  220.     IF b > 500 THEN b = 1
  221.     buildingx(b) = INT(RND * 799) + 1
  222.     buildingy(b) = 310
  223.     buildingsz1(b) = INT(RND * 2) + 1 + e / 4.5
  224.     buildingsz2(b) = INT(RND * 2) + 1 + e / 4.5
  225.     bcolor(b) = INT(RND * 155) + 100
  226. IF b = 0 THEN GOTO skipbuilding2:
  227. FOR bb = 1 TO b
  228.     buildingy(bb) = buildingy(bb) + speed2 / 60
  229.     tilt7 = tilt / 5
  230.     IF tilt7 < 0 THEN tilt7 = -tilt7
  231.     buildingy(bb) = buildingy(bb) + tilt7 / 10
  232.     IF buildingy(bb) > 650 THEN GOTO skipbuilding:
  233.     tttttilt = tilt / 10
  234.     IF tttttilt > 6 THEN tttttilt = 6
  235.     IF tttttilt < -6 THEN tttttilt = -6
  236.     buildingx(bb) = buildingx(bb) + tttttilt
  237.     IF buildingx(bb) < -50 OR buildingx(bb) > 850 THEN GOTO skipbuilding:
  238.     LINE (buildingx(bb), buildingy(bb))-(buildingx(bb) + buildingsz1(bb), buildingy(bb) + buildingsz2(bb)), _RGB32(150, bcolor(bb), bcolor(bb)), BF
  239.  
  240.     'Building Windows
  241.     IF elevation <= 1000 THEN ew = 2
  242.     IF elevation > 1000 AND elevation < 2000 THEN ew = 1
  243.     IF elevation >= 2000 THEN GOTO skipwindows:
  244.  
  245.     bwindowx1 = (buildingx(bb) + buildingsz1(bb)) - 5
  246.     bwindowy1 = (buildingy(bb) + buildingsz2(bb)) - 5
  247.     bwindowx2 = (buildingx(bb) + buildingsz1(bb)) - 10
  248.     bwindowy2 = (buildingy(bb) + buildingsz2(bb)) - 5
  249.     bwindowx3 = (buildingx(bb) + buildingsz1(bb)) - 15
  250.     bwindowy3 = (buildingy(bb) + buildingsz2(bb)) - 5
  251.     bwindowx4 = (buildingx(bb) + buildingsz1(bb)) - 20
  252.     bwindowy4 = (buildingy(bb) + buildingsz2(bb)) - 5
  253.     bwindowx5 = (buildingx(bb) + buildingsz1(bb)) - 5
  254.     bwindowy5 = (buildingy(bb) + buildingsz2(bb)) - 10
  255.     bwindowx6 = (buildingx(bb) + buildingsz1(bb)) - 10
  256.     bwindowy6 = (buildingy(bb) + buildingsz2(bb)) - 10
  257.     bwindowx7 = (buildingx(bb) + buildingsz1(bb)) - 15
  258.     bwindowy7 = (buildingy(bb) + buildingsz2(bb)) - 10
  259.     bwindowx8 = (buildingx(bb) + buildingsz1(bb)) - 20
  260.     bwindowy8 = (buildingy(bb) + buildingsz2(bb)) - 10
  261.     bwindowx9 = (buildingx(bb) + buildingsz1(bb)) - 5
  262.     bwindowy9 = (buildingy(bb) + buildingsz2(bb)) - 15
  263.     bwindowx10 = (buildingx(bb) + buildingsz1(bb)) - 10
  264.     bwindowy10 = (buildingy(bb) + buildingsz2(bb)) - 15
  265.     bwindowx11 = (buildingx(bb) + buildingsz1(bb)) - 15
  266.     bwindowy11 = (buildingy(bb) + buildingsz2(bb)) - 15
  267.     bwindowx12 = (buildingx(bb) + buildingsz1(bb)) - 20
  268.     bwindowy12 = (buildingy(bb) + buildingsz2(bb)) - 15
  269.     bwindowx13 = (buildingx(bb) + buildingsz1(bb)) - 5
  270.     bwindowy13 = (buildingy(bb) + buildingsz2(bb)) - 20
  271.     bwindowx14 = (buildingx(bb) + buildingsz1(bb)) - 10
  272.     bwindowy14 = (buildingy(bb) + buildingsz2(bb)) - 20
  273.     bwindowx15 = (buildingx(bb) + buildingsz1(bb)) - 15
  274.     bwindowy15 = (buildingy(bb) + buildingsz2(bb)) - 20
  275.     bwindowx16 = (buildingx(bb) + buildingsz1(bb)) - 20
  276.     bwindowy16 = (buildingy(bb) + buildingsz2(bb)) - 20
  277.  
  278.     LINE (bwindowx1, bwindowy1)-(bwindowx1 + ew, bwindowy1 + ew), _RGB32(255, 255, 255), BF
  279.     LINE (bwindowx2, bwindowy2)-(bwindowx2 + ew, bwindowy2 + ew), _RGB32(255, 255, 255), BF
  280.     LINE (bwindowx3, bwindowy3)-(bwindowx3 + ew, bwindowy3 + ew), _RGB32(255, 255, 255), BF
  281.     LINE (bwindowx4, bwindowy4)-(bwindowx4 + ew, bwindowy4 + ew), _RGB32(255, 255, 255), BF
  282.     LINE (bwindowx5, bwindowy5)-(bwindowx5 + ew, bwindowy5 + ew), _RGB32(255, 255, 255), BF
  283.     LINE (bwindowx6, bwindowy6)-(bwindowx6 + ew, bwindowy6 + ew), _RGB32(255, 255, 255), BF
  284.     LINE (bwindowx7, bwindowy7)-(bwindowx7 + ew, bwindowy7 + ew), _RGB32(255, 255, 255), BF
  285.     LINE (bwindowx8, bwindowy8)-(bwindowx8 + ew, bwindowy8 + ew), _RGB32(255, 255, 255), BF
  286.     LINE (bwindowx9, bwindowy9)-(bwindowx9 + ew, bwindowy9 + ew), _RGB32(255, 255, 255), BF
  287.     LINE (bwindowx10, bwindowy10)-(bwindowx10 + ew, bwindowy10 + ew), _RGB32(255, 255, 255), BF
  288.     LINE (bwindowx11, bwindowy11)-(bwindowx11 + ew, bwindowy11 + ew), _RGB32(255, 255, 255), BF
  289.     LINE (bwindowx12, bwindowy12)-(bwindowx12 + ew, bwindowy12 + ew), _RGB32(255, 255, 255), BF
  290.     LINE (bwindowx13, bwindowy13)-(bwindowx13 + ew, bwindowy13 + ew), _RGB32(255, 255, 255), BF
  291.     LINE (bwindowx14, bwindowy14)-(bwindowx14 + ew, bwindowy14 + ew), _RGB32(255, 255, 255), BF
  292.     LINE (bwindowx15, bwindowy15)-(bwindowx15 + ew, bwindowy15 + ew), _RGB32(255, 255, 255), BF
  293.     LINE (bwindowx16, bwindowy16)-(bwindowx16 + ew, bwindowy16 + ew), _RGB32(255, 255, 255), BF
  294.     skipwindows:
  295.     skipbuilding:
  296. NEXT bb
  297. skipbuilding2:
  298.  
  299. 'Calculate Compass
  300. tilt2 = tilt
  301. IF tilt2 < 0 THEN tilt2 = -tilt2
  302.  
  303. IF tilt < 0 THEN c = c - tilt2 / 314
  304. IF tilt > 0 THEN c = c + tilt2 / 314
  305. IF c > 359 THEN c = 0
  306. IF c < 0 THEN c = 359
  307. cc = INT(c)
  308. IF cc >= 340 OR cc < 25 THEN comp$ = "North"
  309. IF cc >= 25 AND cc < 65 THEN comp$ = "Northeast"
  310. IF cc >= 65 AND cc < 115 THEN comp$ = "East"
  311. IF cc >= 115 AND cc < 160 THEN comp$ = "Southeast"
  312. IF cc >= 160 AND cc < 205 THEN comp$ = "South"
  313. IF cc >= 205 AND cc < 250 THEN comp$ = "Southwest"
  314. IF cc >= 250 AND cc < 295 THEN comp$ = "West"
  315. IF cc >= 295 AND cc < 340 THEN comp$ = "Northwest"
  316. _PRINTSTRING (390, 550), comp$
  317. cc$ = STR$(cc)
  318. _PRINTSTRING (395, 570), cc$
  319.  
  320. _PRINTSTRING (250, 550), "Altitude"
  321. elevation$ = STR$(elevation)
  322. _PRINTSTRING (255, 570), elevation$
  323.  
  324. _PRINTSTRING (530, 550), "Airspeed"
  325. speed2 = INT(speed2)
  326. speed2$ = STR$(speed2)
  327. _PRINTSTRING (535, 570), speed2$
  328.  
  329. xx = 0: xx2 = 0: xx3 = 0
  330.  
  331.  
  332.