Author Topic: Flying or Driving Example  (Read 5722 times)

0 Members and 1 Guest are viewing this topic.

This topic contains a post which is marked as Best Answer. Press here if you would like to see it.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Flying or Driving Example
« on: September 22, 2019, 08:18:04 pm »
This is simple, but ever since I started QB64 I've kept trying to make this and couldn't get it down, until today. :) So I made this flying/driving example for anyone to use to add to for their own games or programs. You use the arrow keys to move forward, backward, and to each side. It uses small filled in circles and squares on the ground that move as you move. The shapes increase in size slightly as you get closer to them. I might turn this into a game sometime, but I thought I would throw this in here for you guys to have. If you want you can put it in the Toolbox. The sky is blue and the ground is brown. And that's about it. It's just something to add to. Tell me what you think, thanks.

Code: QB64: [Select]
  1. _TITLE "Flying or Driving Example by Ken G. - Use the arrow keys and Esc to quit."
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3. speed = 5
  4. go:
  5. DIM x(200), y(200), s(200)
  6. DIM xx(200), yy(200), ss(200)
  7. DIM c2(400), c3(400)
  8. LINE (0, 0)-(800, 300), _RGB32(127, 166, 255), BF
  9. rocks = INT(RND * 30) + 30
  10. FOR r = 1 TO rocks
  11.     x(r) = INT(RND * 800) + 1
  12.     y(r) = INT(RND * 270) + 330
  13.     s(r) = (y(r) / 20) * 1.3
  14.     c2(r) = INT(RND * 200) + 55
  15.     c3(r) = INT(RND * 200) + 55
  16.     CIRCLE (x(r), y(r)), s(r), _RGB32(0, c2(r), c3(r))
  17.     PAINT (x(r), y(r)), _RGB32(0, c2(r), c3(r))
  18.     xx(r) = INT(RND * 800) + 1
  19.     yy(r) = INT(RND * 270) + 330
  20.     ss(r) = (yy(r) / 50) * 1.3
  21.     LINE (xx(r), yy(r))-(xx(r) + ss(r), yy(r) + ss(r)), _RGB32(0, c2(r), c3(r)), B
  22.     PAINT (xx(r) + 1, yy(r) + 1), _RGB32(0, c2(r), c3(r))
  23.     _LIMIT 100
  24.     a$ = INKEY$
  25.     IF a$ = CHR$(0) + CHR$(72) THEN speed = speed + 2
  26.     IF a$ = CHR$(0) + CHR$(80) THEN speed = speed - 2
  27.     IF a$ = CHR$(0) + CHR$(77) THEN h = h - 2
  28.     IF a$ = CHR$(0) + CHR$(75) THEN h = h + 2
  29.     IF speed > 20 THEN speed = 20
  30.     IF speed < -20 THEN speed = -20
  31.     IF h > 20 THEN h = 20
  32.     IF h < -20 THEN h = -20
  33.     FOR r = 1 TO rocks
  34.         x(r) = x(r) + h
  35.         y(r) = y(r) + speed
  36.         IF x(r) > 800 THEN GOSUB newrockleft:
  37.         IF x(r) < 0 THEN GOSUB newrockright:
  38.         IF y(r) > 600 THEN GOSUB newrocktop:
  39.         IF y(r) < 330 THEN GOSUB newrockbottom:
  40.         s(r) = (y(r) / 100) * 1.3
  41.         CIRCLE (x(r), y(r)), s(r), _RGB32(0, c2(r), c3(r))
  42.         PAINT (x(r), y(r)), _RGB32(0, c2(r), c3(r))
  43.         xx(r) = xx(r) + h
  44.         yy(r) = yy(r) + speed
  45.         IF xx(r) > 800 THEN GOSUB newbuildleft:
  46.         IF xx(r) < 0 THEN GOSUB newbuildright:
  47.         IF yy(r) > 600 THEN GOSUB newbuildtop:
  48.         IF yy(r) < 330 THEN GOSUB newbuildbottom:
  49.         ss(r) = (yy(r) / 50) * 1.3
  50.         RANDOMIZE TIMER
  51.         LINE (xx(r), yy(r))-(xx(r) + ss(r), yy(r) + ss(r)), _RGB32(0, c2(r), c3(r)), B
  52.         PAINT (xx(r) + 1, yy(r) + 1), _RGB32(0, c2(r), c3(r))
  53.     NEXT r
  54.     _DISPLAY
  55.     LINE (0, 301)-(800, 600), _RGB32(127, 127, 0), BF
  56.  
  57. newrockleft:
  58. x(r) = 0
  59. y(r) = INT(RND * 270) + 316
  60. c2(r) = INT(RND * 200) + 55
  61. c3(r) = INT(RND * 200) + 55
  62.  
  63. newrockright:
  64. x(r) = 800
  65. y(r) = INT(RND * 270) + 316
  66. c2(r) = INT(RND * 200) + 55
  67. c3(r) = INT(RND * 200) + 55
  68.  
  69. newrocktop:
  70. x(r) = INT(RND * 800) + 1
  71. y(r) = 330
  72. c2(r) = INT(RND * 200) + 55
  73. c3(r) = INT(RND * 200) + 55
  74.  
  75. newrockbottom:
  76. x(r) = INT(RND * 800) + 1
  77. y(r) = 600
  78. c2(r) = INT(RND * 200) + 55
  79. c3(r) = INT(RND * 200) + 55
  80.  
  81. newbuildleft:
  82. xx(r) = 0
  83. yy(r) = INT(RND * 270) + 316
  84. c2(r) = INT(RND * 200) + 55
  85. c3(r) = INT(RND * 200) + 55
  86.  
  87. newbuildright:
  88. xx(r) = 800
  89. yy(r) = INT(RND * 270) + 316
  90. c2(r) = INT(RND * 200) + 55
  91. c3(r) = INT(RND * 200) + 55
  92.  
  93. newbuildtop:
  94. xx(r) = INT(RND * 800) + 1
  95. yy(r) = 330
  96. c2(r) = INT(RND * 200) + 55
  97. c3(r) = INT(RND * 200) + 55
  98.  
  99. newbuildbottom:
  100. xx(r) = INT(RND * 800) + 1
  101. yy(r) = 600
  102. c2(r) = INT(RND * 200) + 55
  103. c3(r) = INT(RND * 200) + 55
  104.  
« Last Edit: September 22, 2019, 08:23:17 pm by SierraKen »

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Flying or Driving Example
« Reply #1 on: September 22, 2019, 08:49:22 pm »
Not sure where the flicker comes from but this looks a bit more fake-3d:

Code: QB64: [Select]
  1. _TITLE "Flying or Driving Example by Ken G. - Use the arrow keys and Esc to quit."
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3. speed = 5
  4. go:
  5. DIM x(200), y(200), s(200)
  6. DIM xx(200), yy(200), ss(200)
  7. DIM c2(400), c3(400)
  8. LINE (0, 0)-(800, 300), _RGB32(127, 166, 255), BF
  9. rocks = INT(RND * 30) + 30
  10. FOR r = 1 TO rocks
  11.     x(r) = INT(RND * 800) + 1
  12.     y(r) = INT(RND * 270) + 330
  13.     s(r) = (y(r) / 20) * 1.3
  14.     c2(r) = INT(RND * 200) + 55
  15.     c3(r) = INT(RND * 200) + 55
  16.     CIRCLE (x(r), y(r)), s(r), _RGB32(0, c2(r), c3(r))
  17.     PAINT (x(r), y(r)), _RGB32(0, c2(r), c3(r))
  18.     xx(r) = INT(RND * 800) + 1
  19.     yy(r) = INT(RND * 270) + 330
  20.     ss(r) = (yy(r) / 50) * 1.3
  21.     LINE (xx(r), yy(r))-(xx(r) + ss(r), yy(r) + ss(r)), _RGB32(0, c2(r), c3(r)), B
  22.     PAINT (xx(r) + 1, yy(r) + 1), _RGB32(0, c2(r), c3(r))
  23.     _LIMIT 100
  24.     a$ = INKEY$
  25.     IF a$ = CHR$(0) + CHR$(72) THEN speed = speed + 2
  26.     IF a$ = CHR$(0) + CHR$(80) THEN speed = speed - 2
  27.     IF a$ = CHR$(0) + CHR$(77) THEN h = h - 2
  28.     IF a$ = CHR$(0) + CHR$(75) THEN h = h + 2
  29.     IF speed > 20 THEN speed = 20
  30.     IF speed < -20 THEN speed = -20
  31.     IF h > 20 THEN h = 20
  32.     IF h < -20 THEN h = -20
  33.     FOR r = 1 TO rocks
  34.         x(r) = x(r) + .01 * (x(r) - 400)
  35.         y(r) = y(r) + 50 * speed / (601 - y(r))
  36.  
  37.         IF x(r) > 800 THEN GOSUB newrockleft:
  38.         IF x(r) < 0 THEN GOSUB newrockright:
  39.         IF y(r) > 600 THEN GOSUB newrocktop:
  40.         IF y(r) < 330 THEN GOSUB newrockbottom:
  41.         s(r) = (y(r) / 100) * 1.3
  42.         CIRCLE (x(r), y(r)), s(r), _RGB32(0, c2(r), c3(r))
  43.         PAINT (x(r), y(r)), _RGB32(0, c2(r), c3(r))
  44.         xx(r) = xx(r) + .01 * (xx(r) - 400)
  45.         yy(r) = yy(r) + 50 * speed / (601 - yy(r))
  46.         IF xx(r) > 800 THEN GOSUB newbuildleft:
  47.         IF xx(r) < 0 THEN GOSUB newbuildright:
  48.         IF yy(r) > 600 THEN GOSUB newbuildtop:
  49.         IF yy(r) < 330 THEN GOSUB newbuildbottom:
  50.         ss(r) = (yy(r) / 50) * 1.3
  51.         RANDOMIZE TIMER
  52.         LINE (xx(r), yy(r))-(xx(r) + ss(r), yy(r) + ss(r)), _RGB32(0, c2(r), c3(r)), B
  53.         PAINT (xx(r) + 1, yy(r) + 1), _RGB32(0, c2(r), c3(r))
  54.     NEXT r
  55.     _DISPLAY
  56.     LINE (0, 301)-(800, 600), _RGB32(127, 127, 0), BF
  57.  
  58. newrockleft:
  59. x(r) = 0
  60. y(r) = INT(RND * 270) + 316
  61. c2(r) = INT(RND * 200) + 55
  62. c3(r) = INT(RND * 200) + 55
  63.  
  64. newrockright:
  65. x(r) = 800
  66. y(r) = INT(RND * 270) + 316
  67. c2(r) = INT(RND * 200) + 55
  68. c3(r) = INT(RND * 200) + 55
  69.  
  70. newrocktop:
  71. x(r) = INT(RND * 800) + 1
  72. y(r) = 330
  73. c2(r) = INT(RND * 200) + 55
  74. c3(r) = INT(RND * 200) + 55
  75.  
  76. newrockbottom:
  77. x(r) = INT(RND * 800) + 1
  78. y(r) = 600
  79. c2(r) = INT(RND * 200) + 55
  80. c3(r) = INT(RND * 200) + 55
  81.  
  82. newbuildleft:
  83. xx(r) = 0
  84. yy(r) = INT(RND * 270) + 316
  85. c2(r) = INT(RND * 200) + 55
  86. c3(r) = INT(RND * 200) + 55
  87.  
  88. newbuildright:
  89. xx(r) = 800
  90. yy(r) = INT(RND * 270) + 316
  91. c2(r) = INT(RND * 200) + 55
  92. c3(r) = INT(RND * 200) + 55
  93.  
  94. newbuildtop:
  95. xx(r) = INT(RND * 800) + 1
  96. yy(r) = 330
  97. c2(r) = INT(RND * 200) + 55
  98. c3(r) = INT(RND * 200) + 55
  99.  
  100. newbuildbottom:
  101. xx(r) = INT(RND * 800) + 1
  102. yy(r) = 600
  103. c2(r) = INT(RND * 200) + 55
  104. c3(r) = INT(RND * 200) + 55
  105.  
  106.  
You're not done when it works, you're done when it's right.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Flying or Driving Example
« Reply #2 on: September 22, 2019, 08:59:02 pm »
(deleted by poster)
« Last Edit: September 22, 2019, 09:22:22 pm by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Flying or Driving Example
« Reply #3 on: September 22, 2019, 09:01:06 pm »
(deleted by poster)
« Last Edit: September 22, 2019, 09:22:10 pm by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Flying or Driving Example
« Reply #4 on: September 22, 2019, 09:07:51 pm »
(deleted by poster)
« Last Edit: September 22, 2019, 09:21:56 pm by SierraKen »

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Flying or Driving Example
« Reply #5 on: September 22, 2019, 10:16:07 pm »
Fake 3D is exactly what it sounds like
You're not done when it works, you're done when it's right.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Flying or Driving Example
« Reply #6 on: September 22, 2019, 10:36:07 pm »
Fake 3D or not.... It's a start. What's next?
Logic is the beginning of wisdom.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Flying or Driving Example
« Reply #7 on: September 22, 2019, 10:41:49 pm »
Static, I apologize for thinking you were calling my program a big fake. I just am not having a good afternoon. I know you are trying to help and I'm sorry. This program itself is just something close to me that I've worked off and on for months and finally am close to something. I am adding clouds right now.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Flying or Driving Example
« Reply #8 on: September 22, 2019, 10:46:01 pm »
Hey Ken, nice array work!

I think StxAxTIC was just attempting to show more realistic perspective.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Flying or Driving Example
« Reply #9 on: September 22, 2019, 10:54:32 pm »
Thanks B+ :). Clouds are pretty tough lol.. might not be able to get them done tonight.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Flying or Driving Example
« Reply #10 on: September 22, 2019, 11:13:57 pm »
OK I did it. I got the clouds moving. I spoofed it up some too by making the land shapes bigger and not as many.
Use the arrow keys to move forward, backward, side-to-side.

Code: QB64: [Select]
  1. _TITLE "Flying or Driving Example by Ken G. - Use the arrow keys and Esc to quit."
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3. speed = 5
  4. go:
  5. DIM x(200), y(200), s(200)
  6. DIM xx(200), yy(200), ss(200)
  7. DIM c2(400), c3(400)
  8. DIM cx(100), cy(100), sss(100)
  9. rocks = INT(RND * 10) + 10
  10. FOR r = 1 TO rocks
  11.     x(r) = INT(RND * 800) + 1
  12.     y(r) = INT(RND * 270) + 330
  13.     s(r) = (y(r) / 20)
  14.     c2(r) = INT(RND * 200) + 55
  15.     c3(r) = INT(RND * 200) + 55
  16.     CIRCLE (x(r), y(r)), s(r), _RGB32(0, c2(r), c3(r))
  17.     PAINT (x(r), y(r)), _RGB32(0, c2(r), c3(r))
  18.     xx(r) = INT(RND * 800) + 1
  19.     yy(r) = INT(RND * 270) + 330
  20.     ss(r) = (yy(r) / 20)
  21.     LINE (xx(r), yy(r))-(xx(r) + ss(r), yy(r) + ss(r)), _RGB32(0, c2(r), c3(r)), B
  22.     PAINT (xx(r) + 1, yy(r) + 1), _RGB32(0, c2(r), c3(r))
  23. clouds = INT(RND * 20) + 1
  24. FOR cc = 1 TO clouds
  25.     cx(cc) = INT(RND * 700) + 100
  26.     cy(cc) = INT(RND * 250) + 1
  27.     sss(cc) = (cy(cc) / 5)
  28.     CIRCLE (cx(cc), cy(cc)), sss(cc), _RGB32(255, 255, 255), , , .5
  29. NEXT cc
  30.     _LIMIT 100
  31.     a$ = INKEY$
  32.     IF a$ = CHR$(0) + CHR$(72) THEN speed = speed + 2
  33.     IF a$ = CHR$(0) + CHR$(80) THEN speed = speed - 2
  34.     IF a$ = CHR$(0) + CHR$(77) THEN h = h - 2
  35.     IF a$ = CHR$(0) + CHR$(75) THEN h = h + 2
  36.     IF speed > 20 THEN speed = 20
  37.     IF speed < -20 THEN speed = -20
  38.     IF h > 20 THEN h = 20
  39.     IF h < -20 THEN h = -20
  40.     FOR r = 1 TO rocks
  41.         x(r) = x(r) + h
  42.         y(r) = y(r) + speed
  43.         IF x(r) > 800 THEN GOSUB newrockleft:
  44.         IF x(r) < 0 THEN GOSUB newrockright:
  45.         IF y(r) > 600 THEN GOSUB newrocktop:
  46.         IF y(r) < 330 THEN GOSUB newrockbottom:
  47.         s(r) = (y(r) / 20)
  48.         CIRCLE (x(r), y(r)), s(r), _RGB32(0, c2(r), c3(r))
  49.         PAINT (x(r), y(r)), _RGB32(0, c2(r), c3(r))
  50.         xx(r) = xx(r) + h
  51.         yy(r) = yy(r) + speed
  52.         IF xx(r) > 800 THEN GOSUB newbuildleft:
  53.         IF xx(r) < 0 THEN GOSUB newbuildright:
  54.         IF yy(r) > 600 THEN GOSUB newbuildtop:
  55.         IF yy(r) < 330 THEN GOSUB newbuildbottom:
  56.         ss(r) = (yy(r) / 20)
  57.         LINE (xx(r), yy(r))-(xx(r) + ss(r), yy(r) + ss(r)), _RGB32(0, c2(r), c3(r)), B
  58.         PAINT (xx(r) + 1, yy(r) + 1), _RGB32(0, c2(r), c3(r))
  59.     NEXT r
  60.     FOR cc = 1 TO clouds
  61.         cx(cc) = cx(cc) + h
  62.         cy(cc) = cy(cc) - speed
  63.         IF cx(cc) > 800 THEN GOSUB newcloudleft:
  64.         IF cx(cc) < 0 THEN GOSUB newcloudright:
  65.         IF cy(cc) > 275 THEN GOSUB newcloudtop:
  66.         IF cy(cc) < 0 THEN GOSUB newcloudbottom:
  67.         sss(cc) = cy(cc) / 5
  68.         FOR sz = .25 TO sss(cc)
  69.             CIRCLE (cx(cc), cy(cc)), sz, _RGB32(255, 255, 255), , , .5
  70.         NEXT sz
  71.     NEXT cc
  72.     _DISPLAY
  73.     LINE (0, 301)-(800, 600), _RGB32(127, 127, 0), BF
  74.     LINE (0, 0)-(800, 300), _RGB32(127, 166, 255), BF
  75.  
  76. newrockleft:
  77. x(r) = 0
  78. y(r) = INT(RND * 270) + 316
  79. c2(r) = INT(RND * 200) + 55
  80. c3(r) = INT(RND * 200) + 55
  81.  
  82. newrockright:
  83. x(r) = 800
  84. y(r) = INT(RND * 270) + 316
  85. c2(r) = INT(RND * 200) + 55
  86. c3(r) = INT(RND * 200) + 55
  87.  
  88. newrocktop:
  89. x(r) = INT(RND * 800) + 1
  90. y(r) = 330
  91. c2(r) = INT(RND * 200) + 55
  92. c3(r) = INT(RND * 200) + 55
  93.  
  94. newrockbottom:
  95. x(r) = INT(RND * 800) + 1
  96. y(r) = 600
  97. c2(r) = INT(RND * 200) + 55
  98. c3(r) = INT(RND * 200) + 55
  99.  
  100. newbuildleft:
  101. xx(r) = 0
  102. yy(r) = INT(RND * 270) + 316
  103. c2(r) = INT(RND * 200) + 55
  104. c3(r) = INT(RND * 200) + 55
  105.  
  106. newbuildright:
  107. xx(r) = 800
  108. yy(r) = INT(RND * 270) + 316
  109. c2(r) = INT(RND * 200) + 55
  110. c3(r) = INT(RND * 200) + 55
  111.  
  112. newbuildtop:
  113. xx(r) = INT(RND * 800) + 1
  114. yy(r) = 330
  115. c2(r) = INT(RND * 200) + 55
  116. c3(r) = INT(RND * 200) + 55
  117.  
  118. newbuildbottom:
  119. xx(r) = INT(RND * 800) + 1
  120. yy(r) = 600
  121. c2(r) = INT(RND * 200) + 55
  122. c3(r) = INT(RND * 200) + 55
  123.  
  124. newcloudleft:
  125. cx(cc) = 0
  126. cy(cc) = INT(RND * 270) + 316
  127.  
  128. newcloudright:
  129. cx(cc) = 800
  130. cy(cc) = INT(RND * 270) + 316
  131.  
  132. newcloudtop:
  133. cx(cc) = INT(RND * 800) + 1
  134. cy(cc) = 0
  135.  
  136. newcloudbottom:
  137. cx(cc) = INT(RND * 800) + 1
  138. cy(cc) = 275
  139.  
  140.  

Marked as best answer by SierraKen on September 22, 2019, 07:18:27 pm

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Flying or Driving Example
« Reply #11 on: September 22, 2019, 11:18:04 pm »
Woops, I forgot 1 key thing, the step command to fill each cloud. I wondered why they weren't getting filled 100%. lol At first I tried PAINT but when they overlap, there's a problem filling them in.
So I did my old loop trick again.

Code: QB64: [Select]
  1. _TITLE "Flying or Driving Example by Ken G. - Use the arrow keys and Esc to quit."
  2. SCREEN _NEWIMAGE(800, 600, 32)
  3. speed = 5
  4. go:
  5. DIM x(200), y(200), s(200)
  6. DIM xx(200), yy(200), ss(200)
  7. DIM c2(400), c3(400)
  8. DIM cx(100), cy(100), sss(100)
  9. rocks = INT(RND * 10) + 10
  10. FOR r = 1 TO rocks
  11.     x(r) = INT(RND * 800) + 1
  12.     y(r) = INT(RND * 270) + 330
  13.     s(r) = (y(r) / 20)
  14.     c2(r) = INT(RND * 200) + 55
  15.     c3(r) = INT(RND * 200) + 55
  16.     CIRCLE (x(r), y(r)), s(r), _RGB32(0, c2(r), c3(r))
  17.     PAINT (x(r), y(r)), _RGB32(0, c2(r), c3(r))
  18.     xx(r) = INT(RND * 800) + 1
  19.     yy(r) = INT(RND * 270) + 330
  20.     ss(r) = (yy(r) / 20)
  21.     LINE (xx(r), yy(r))-(xx(r) + ss(r), yy(r) + ss(r)), _RGB32(0, c2(r), c3(r)), B
  22.     PAINT (xx(r) + 1, yy(r) + 1), _RGB32(0, c2(r), c3(r))
  23. clouds = INT(RND * 20) + 1
  24. FOR cc = 1 TO clouds
  25.     cx(cc) = INT(RND * 700) + 100
  26.     cy(cc) = INT(RND * 250) + 1
  27.     sss(cc) = (cy(cc) / 5)
  28.     CIRCLE (cx(cc), cy(cc)), sss(cc), _RGB32(255, 255, 255), , , .5
  29. NEXT cc
  30.     _LIMIT 100
  31.     a$ = INKEY$
  32.     IF a$ = CHR$(0) + CHR$(72) THEN speed = speed + 2
  33.     IF a$ = CHR$(0) + CHR$(80) THEN speed = speed - 2
  34.     IF a$ = CHR$(0) + CHR$(77) THEN h = h - 2
  35.     IF a$ = CHR$(0) + CHR$(75) THEN h = h + 2
  36.     IF speed > 20 THEN speed = 20
  37.     IF speed < -20 THEN speed = -20
  38.     IF h > 20 THEN h = 20
  39.     IF h < -20 THEN h = -20
  40.     FOR r = 1 TO rocks
  41.         x(r) = x(r) + h
  42.         y(r) = y(r) + speed
  43.         IF x(r) > 800 THEN GOSUB newrockleft:
  44.         IF x(r) < 0 THEN GOSUB newrockright:
  45.         IF y(r) > 600 THEN GOSUB newrocktop:
  46.         IF y(r) < 330 THEN GOSUB newrockbottom:
  47.         s(r) = (y(r) / 20)
  48.         CIRCLE (x(r), y(r)), s(r), _RGB32(0, c2(r), c3(r))
  49.         PAINT (x(r), y(r)), _RGB32(0, c2(r), c3(r))
  50.         xx(r) = xx(r) + h
  51.         yy(r) = yy(r) + speed
  52.         IF xx(r) > 800 THEN GOSUB newbuildleft:
  53.         IF xx(r) < 0 THEN GOSUB newbuildright:
  54.         IF yy(r) > 600 THEN GOSUB newbuildtop:
  55.         IF yy(r) < 330 THEN GOSUB newbuildbottom:
  56.         ss(r) = (yy(r) / 20)
  57.         LINE (xx(r), yy(r))-(xx(r) + ss(r), yy(r) + ss(r)), _RGB32(0, c2(r), c3(r)), B
  58.         PAINT (xx(r) + 1, yy(r) + 1), _RGB32(0, c2(r), c3(r))
  59.     NEXT r
  60.     FOR cc = 1 TO clouds
  61.         cx(cc) = cx(cc) + h
  62.         cy(cc) = cy(cc) - speed
  63.         IF cx(cc) > 800 THEN GOSUB newcloudleft:
  64.         IF cx(cc) < 0 THEN GOSUB newcloudright:
  65.         IF cy(cc) > 275 THEN GOSUB newcloudtop:
  66.         IF cy(cc) < 0 THEN GOSUB newcloudbottom:
  67.         sss(cc) = cy(cc) / 5
  68.         FOR sz = .25 TO sss(cc) STEP .25
  69.             CIRCLE (cx(cc), cy(cc)), sz, _RGB32(255, 255, 255), , , .5
  70.         NEXT sz
  71.     NEXT cc
  72.     _DISPLAY
  73.     LINE (0, 301)-(800, 600), _RGB32(127, 127, 0), BF
  74.     LINE (0, 0)-(800, 300), _RGB32(127, 166, 255), BF
  75.  
  76. newrockleft:
  77. x(r) = 0
  78. y(r) = INT(RND * 270) + 316
  79. c2(r) = INT(RND * 200) + 55
  80. c3(r) = INT(RND * 200) + 55
  81.  
  82. newrockright:
  83. x(r) = 800
  84. y(r) = INT(RND * 270) + 316
  85. c2(r) = INT(RND * 200) + 55
  86. c3(r) = INT(RND * 200) + 55
  87.  
  88. newrocktop:
  89. x(r) = INT(RND * 800) + 1
  90. y(r) = 330
  91. c2(r) = INT(RND * 200) + 55
  92. c3(r) = INT(RND * 200) + 55
  93.  
  94. newrockbottom:
  95. x(r) = INT(RND * 800) + 1
  96. y(r) = 600
  97. c2(r) = INT(RND * 200) + 55
  98. c3(r) = INT(RND * 200) + 55
  99.  
  100. newbuildleft:
  101. xx(r) = 0
  102. yy(r) = INT(RND * 270) + 316
  103. c2(r) = INT(RND * 200) + 55
  104. c3(r) = INT(RND * 200) + 55
  105.  
  106. newbuildright:
  107. xx(r) = 800
  108. yy(r) = INT(RND * 270) + 316
  109. c2(r) = INT(RND * 200) + 55
  110. c3(r) = INT(RND * 200) + 55
  111.  
  112. newbuildtop:
  113. xx(r) = INT(RND * 800) + 1
  114. yy(r) = 330
  115. c2(r) = INT(RND * 200) + 55
  116. c3(r) = INT(RND * 200) + 55
  117.  
  118. newbuildbottom:
  119. xx(r) = INT(RND * 800) + 1
  120. yy(r) = 600
  121. c2(r) = INT(RND * 200) + 55
  122. c3(r) = INT(RND * 200) + 55
  123.  
  124. newcloudleft:
  125. cx(cc) = 0
  126. cy(cc) = INT(RND * 270) + 316
  127.  
  128. newcloudright:
  129. cx(cc) = 800
  130. cy(cc) = INT(RND * 270) + 316
  131.  
  132. newcloudtop:
  133. cx(cc) = INT(RND * 800) + 1
  134. cy(cc) = 0
  135.  
  136. newcloudbottom:
  137. cx(cc) = INT(RND * 800) + 1
  138. cy(cc) = 275
  139.  
  140.