Author Topic: Ken's U.S. Flag version 4 - With moving clouds  (Read 7090 times)

0 Members and 1 Guest are viewing this topic.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Ken's U.S. Flag version 4 - With moving clouds
« Reply #15 on: February 09, 2022, 03:05:04 pm »
Wouldn't you just draw the clouds on top of the sky?  A simple change in order of operations might be all you need.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Ken's U.S. Flag version 4 - With moving clouds
« Reply #16 on: February 09, 2022, 03:11:55 pm »
Steve, no reason to if you would never see it. The clouds are there 24/7 unless I want to change it. But I would rather not because the clouds are so cool to watch.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Ken's U.S. Flag version 4 - With moving clouds
« Reply #17 on: February 09, 2022, 03:24:51 pm »
@SMcNeill  the clouds are sky and cloud generated by a noise texture routine first discussed here:
https://qb64forum.alephc.xyz/index.php?topic=4615.msg140454#msg140454

Vince made a good mod of some code I translated from Yabasic.

Then Ken probably picked up here:
https://qb64forum.alephc.xyz/index.php?topic=4638.msg140509#msg140509
Where vince included the sky cloud code without labels in Falling letters game.

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: Ken's U.S. Flag version 4 - With moving clouds
« Reply #18 on: February 12, 2022, 05:55:44 pm »
B+ mod time, you know the drill

Code: QB64: [Select]
  1. _Title "U.S. Flag - Use space bar to change hills background."
  2. const sw = 800
  3. const sh = 600
  4. Screen _NewImage(sw, sh, 32)
  5. x = 150
  6. y = 100
  7. Dim cf&(113000)
  8.  
  9. Const nn = 1
  10. Const twidth = sw, theight = sh, zoom = 128
  11. Dim Shared noise(nn * twidth * theight) '//the noise array
  12. Dim Shared texture(nn * twidth * theight) '//texture array
  13. Dim Shared pal(256) As _Unsigned Long '//color palette
  14.  
  15. MakePalette 255, 155, 255, 10, 100, 180
  16. GenerateNoise
  17. buildtexture
  18.  
  19. vs = _NewImage(twidth, theight, 32)
  20. drawtexture 0
  21.  
  22. GoSub hills:
  23.  
  24. dim vvs as long
  25. vvs = _newimage(sw, sh, 32)
  26. vvs2 = _newimage(sw, sh, 32)
  27. _dest vvs
  28.  
  29. 'Stars
  30. Line (x, y)-(x + 185, y + 130), _RGB32(0, 0, 255), BF
  31. For xx = 155 To 345 Step 32
  32.     For yy = 105 To 220 Step 28
  33.         Line (xx + 2, yy + 12)-(xx + 7, yy), _RGB32(255, 255, 255)
  34.         Line (xx + 7, yy)-(xx + 13, yy + 12), _RGB32(255, 255, 255)
  35.         Line (xx + 13, yy + 12)-(xx, yy + 5), _RGB32(255, 255, 255)
  36.         Line (xx, yy + 5)-(xx + 15, yy + 5), _RGB32(255, 255, 255)
  37.         Line (xx + 15, yy + 5)-(xx + 2, yy + 12), _RGB32(255, 255, 255)
  38.         Paint (xx + 7, yy + 2), _RGB32(255, 255, 255)
  39.         Paint (xx + 7, yy + 6), _RGB32(255, 255, 255)
  40.         Paint (xx + 11, yy + 10), _RGB32(255, 255, 255)
  41.         Paint (xx + 4, yy + 10), _RGB32(255, 255, 255)
  42.         Paint (xx + 3, yy + 6), _RGB32(255, 255, 255)
  43.         Paint (xx + 12, yy + 6), _RGB32(255, 255, 255)
  44.     Next yy
  45. Next xx
  46.  
  47. For xx = 172 To 329 Step 32
  48.     For yy = 118.9 To 213.05 Step 28
  49.         Line (xx + 2, yy + 12)-(xx + 7, yy), _RGB32(255, 255, 255)
  50.         Line (xx + 7, yy)-(xx + 13, yy + 12), _RGB32(255, 255, 255)
  51.         Line (xx + 13, yy + 12)-(xx, yy + 5), _RGB32(255, 255, 255)
  52.         Line (xx, yy + 5)-(xx + 15, yy + 5), _RGB32(255, 255, 255)
  53.         Line (xx + 15, yy + 5)-(xx + 2, yy + 12), _RGB32(255, 255, 255)
  54.         Paint (xx + 7, yy + 2), _RGB32(255, 255, 255)
  55.         Paint (xx + 7, yy + 6), _RGB32(255, 255, 255)
  56.         Paint (xx + 11, yy + 10), _RGB32(255, 255, 255)
  57.         Paint (xx + 4, yy + 10), _RGB32(255, 255, 255)
  58.         Paint (xx + 3, yy + 6), _RGB32(255, 255, 255)
  59.         Paint (xx + 12, yy + 6), _RGB32(255, 255, 255)
  60.     Next yy
  61. Next xx
  62.  
  63. 'Stripes
  64. For rs = 100 To 230 Step 37.2
  65.     w = w + 1
  66.     Line (335, rs)-(612.5, rs + 18.6), _RGB32(255, 0, 0), BF
  67.     If w > 3 Then GoTo nex:
  68.     Line (335, rs + 18.6)-(612.5, rs + 37.2), _RGB32(255, 255, 255), BF
  69. Next rs
  70. nex:
  71. w = 0
  72. dim z(98) as _unsigned _integer64 'Marshawn polynomial coefficients of the nth order
  73. z(0)=&h3000000~&&:z(1)=&hFFF8~&&:z(2)=&h0~&&:z(3)=&h830E000000000000~&&
  74. z(4)=&h47FF080000000~&&:z(5)=&h1BFFFE6000~&&:z(6)=&h37FFFE~&&
  75. z(7)=&h900000000000006E~&&:z(8)=&hFFFFC80000000000~&&:z(9)=&h5FFFFFE8000000~&&
  76. z(10)=&hBFFFFFF400~&&:z(11)=&h17FFFFE~&&:z(12)=&hF80000000000017A~&&
  77. z(13)=&hFFFFFA0000000000~&&:z(14)=&h2F7FFFFFA000000~&&:z(15)=&h2EDFFFFFF00~&&
  78. z(16)=&h2DBFFFE~&&:z(17)=&hFD000000000002D6~&&:z(18)=&hFFFFED0000000000~&&
  79. z(19)=&h2B7FFFFAD000000~&&:z(20)=&h6B41FC7AD00~&&:z(21)=&h6E3EFB8~&&
  80. z(22)=&hAD0000000000066C~&&:z(23)=&h17463D0000000000~&&:z(24)=&h2D016C0B5000000~&&
  81. z(25)=&h2B00A805900~&&:z(26)=&h2A00A80~&&:z(27)=&h1B000000000002A0~&&
  82. z(28)=&h9801A0000000000~&&:z(29)=&h3A00A801A000000~&&:z(30)=&hA008805A00~&&
  83. z(31)=&h901660~&&:z(32)=&h580000000000026E~&&:z(33)=&hEC90D00000000000~&&
  84. z(34)=&h2F0096F2F000000~&&:z(35)=&h6FFE9B0F100~&&:z(36)=&h2FFD0BE~&&
  85. z(37)=&hFD000000000002C6~&&:z(38)=&hD2DFFD0000000000~&&:z(39)=&h33BD55F1B000000~&&
  86. z(40)=&h16DEDBDEA00~&&:z(41)=&h54F27A~&&:z(42)=&hF400000000000046~&&
  87. z(43)=&hEEFAA80000000000~&&:z(44)=&h4B5D5EA0000000~&&:z(45)=&h6BD1AFA000~&&
  88. z(46)=&h69FFFA~&&:z(47)=&h64~&&:z(48)=&h57AB400000000000~&&:z(49)=&h25D7AF40000000~&&
  89. z(50)=&h2BF3BF4000~&&:z(51)=&h2B7FEE~&&:z(52)=&h4000000000000024~&&
  90. z(53)=&h6EAEC00000000000~&&:z(54)=&h19FEBC80000000~&&:z(55)=&h4FFBC8000~&&
  91. z(56)=&hE000003C0002AFC8~&&:z(57)=&h1080000420000~&&:z(58)=&h7032000204000040~&&
  92. z(59)=&hBFEC00020400~&&:z(60)=&h8080009FC80004~&&:z(61)=&h400004060004010~&&
  93. z(62)=&h18040000C19C00~&&:z(63)=&h3FE0007604000080~&&:z(64)=&h8700000003860400~&&
  94. z(65)=&h100F0E000000C1E~&&:z(66)=&h2000100E61C0000~&&:z(67)=&hE1CC010001009FC2~&&
  95. z(68)=&hC0078FF601000100~&&:z(69)=&h3B8703837020200~&&:z(70)=&h101803F2FC3B002~&&
  96. z(71)=&h2000101FC07F83E~&&:z(72)=&h80FE0200008207C0~&&:z(73)=&hF01C0F810600005C~&&
  97. z(74)=&h3C00007800E800~&&:z(75)=&h1F00036000~&&:z(76)=&h1DFE01E~&&
  98. z(77)=&hEE00000000001E7E~&&:z(78)=&h8307F9E000000000~&&:z(79)=&hE3FC1CE07F1C0000~&&
  99. z(80)=&h381E3FC1C00E0FF0~&&:z(81)=&hC03047F1FF0F0002~&&:z(82)=&hC3FE3FC8C31E7078~&&
  100. z(83)=&h3839C10C83E2~&&:z(84)=&h8180000006071B04~&&:z(85)=&hC2180C00000000C0~&&
  101. z(86)=&h610442E070000000~&&:z(87)=&h381D085B018000~&&:z(88)=&h60348360C~&&:z(89)=&h181B0~&&
  102. z(90)=&h2430000000000000~&&:z(91)=&h30D0C04000000000~&&:z(92)=&h80D00800000~&&
  103. z(93)=&h4070100~&&:z(94)=&h202~&&:z(95)=&h8200000000000000~&&:z(96)=&h1045C0000000000~&&
  104. z(97)=&hEC60000000~&&
  105. dim as _unsigned _integer64 b, i, n, j,d
  106. redim f(320, 240) as double
  107. redim ff(320, 240) as double
  108. dim p(300) as long
  109. for i=1 to 100
  110.         fr = 240*i/100 + 15
  111.         p(i) = _rgb(fr,0,0)
  112.         p(i + 100) = _rgb(255, fr, 0)
  113.         p(i + 200) = _rgb(255, 255, fr)
  114. For rs = 230 To 341.6 Step 37.2
  115.     r = r + 1
  116.     Line (150, rs)-(612.5, rs + 18.6), _RGB32(255, 255, 255), BF
  117.     If r > 3 Then GoTo nex2:
  118.     Line (150, rs + 18.6)-(612.5, rs + 37.2), _RGB32(255, 0, 0), BF
  119. Next rs
  120. i = 0
  121. n = 0
  122. b = z(n)
  123. xstep = 3
  124. ystep = 2
  125. for y=0 to 79-1
  126. for x=0 to 80-1
  127.         if (b and _shl(1~&&, 63)) then
  128.                 line (280 + x*xstep, 150 + y*ystep)-step(xstep,ystep),_rgb(0,0,0),bf
  129.                 f (x + 120, y + 80) = 300
  130.                 ff(x + 120, y + 80) = 300
  131.         end if
  132.         b = _shl(b, 1~&&)
  133.         i=i+1
  134.         if i = 64 then
  135.                 n = n + 1
  136.                 b = z(n)
  137.                 i = 0
  138.         end if
  139. paint (370,190),_rgb(0,0,0)
  140. paint (420,190),_rgb(0,0,0)
  141. _source vvs2
  142. nex2:
  143. r = 0
  144. For fy = 100 To 341.6
  145.     For fx = 150 To 612.5
  146.         t5 = t5 + 1
  147.         cf&(t5) = Point(fx, fy)
  148.     Next fx
  149. Next fy
  150. t = 20
  151.  
  152. 'On Timer(2) GoSub hills:
  153. 'Timer On
  154.  
  155. ii = 0
  156. jj = -1
  157.  
  158.     'Sky
  159.     ii = ii + 1
  160.     If ii >= sw Then
  161.         ii = 0
  162.         jj = Not jj
  163.     End If
  164.  
  165.     If jj Then
  166.         _PutImage (ii, 0)-Step(sw, sh), vs
  167.         _PutImage (ii, 0)-Step(-sw, sh), vs
  168.     Else
  169.         _PutImage (ii + sw, 0)-Step(-sw, sh), vs
  170.         _PutImage (ii - sw, 0)-Step(sw, sh), vs
  171.     End If
  172.  
  173.     'hour$ = Left$(Time$, 2)
  174.     'hour = Val(hour$)
  175.     'If hour < 21 And hour >= 6 Then
  176.         'Paint (2, 2), _RGB32(0, 205, 255)
  177.     'End If
  178.     _PutImage , hills&, 0
  179.     'Flag Pole
  180.     For sz = .25 To 10 Step .25
  181.         Circle (145, 80), sz, _RGB32(122, 128, 166)
  182.     Next sz
  183.     Line (142, 80)-(147, 600), _RGB32(122, 128, 166), BF
  184.  
  185.         _dest vvs2
  186.         _putimage ,vvs
  187.         for y=1 to 240-1
  188.         for x=1 to 320-1
  189.                 dim r as double
  190.                 r = rnd
  191.                 if r > 0.65 then f(x,y) = ff(x,y)
  192.         next
  193.         next
  194.         for y=0 to 240-2
  195.         for x=1 to 320-1
  196.                 f(x,y) = max((f(x-1,y+1) + f(x,y+1) + f(x+1,y+1) + f(x-1,y+2))/4 - 5, 0)
  197.                 line (x*xstep - 81, y*ystep - 6)-step(xstep, ystep), p(f(x,y)),bf
  198.         next
  199.         next
  200.  
  201.         _source vvs2
  202.         r = 0
  203.         t5 = 0
  204.         For fy = 100 To 341.6
  205.                 For fx = 150 To 612.5
  206.                         t5 = t5 + 1
  207.                         cf&(t5) = Point(fx, fy)
  208.                 Next fx
  209.         Next fy
  210.         t = 20
  211.         _source 0
  212.         _dest 0
  213.  
  214.     fx2 = fx2 + 1.2
  215.     If fx2 > 5 Then fx2 = 1.2
  216.     For fy = 100 To 341.6
  217.         For fx = 150 To 612.5
  218.             t6 = t6 + 1
  219.                         if cf&(t6) <> _rgb(0,0,0) then
  220.                         PSet ((Sin(fy * 0.017453 / fx2) * t) + fx, (Sin(fx * 0.017453 / fx2) * t) + fy), cf&(t6)
  221.                         end if
  222.         Next fx
  223.     Next fy
  224.  
  225.     t6 = 0
  226.     If tt = 0 Then t = t + 1
  227.     If t > 10 Then tt = 1
  228.     If tt = 1 Then t = t - 1
  229.     If t < -10 Then tt = 0
  230.     a$ = InKey$
  231.     If a$ = Chr$(27) Then End
  232.     'If a$ = " " Then
  233.         GoSub hills:
  234.  
  235.     _Display
  236.     _Limit 50
  237.  
  238. hills:
  239. 'Random Hills
  240. hills& = _NewImage(_Width, _Height, 32)
  241. _Dest hills&
  242. hills = 8'Int(Rnd * 40) + 3
  243. For h = -3 To hills + 1
  244.     hx = 800*h/hills + (ii*8 mod 300) 'Int(Rnd * 800) + 1
  245.     size = 300'Int(Rnd * 450) + 75
  246.     cl = 15'Int(Rnd * 55)
  247.     shape = 0.7'Rnd
  248.     For sz = .25 To size Step .25
  249.         cl = cl + .05
  250.         Circle (hx, 599), sz, _RGB32(10, cl, 20), , , shape
  251.     Next sz
  252. hills = 5'Int(Rnd * 40) + 3
  253. For h = -3 To hills + 1
  254.     hx = 800*h/hills + (ii*5 mod 300) 'Int(Rnd * 800) + 1
  255.     size = 250'Int(Rnd * 450) + 75
  256.     cl = 35'Int(Rnd * 55)
  257.     shape = 0.7'Rnd
  258.     For sz = .25 To size Step .25
  259.         cl = cl + .05
  260.         Circle (hx, 599), sz, _RGB32(10, cl, 20), , , shape
  261.     Next sz
  262. hills = 3'Int(Rnd * 40) + 3
  263. For h = -3 To hills + 1
  264.     hx = 800*h/hills + (ii mod 300) 'Int(Rnd * 800) + 1
  265.     size = 180'Int(Rnd * 450) + 75
  266.     cl = 55'Int(Rnd * 55)
  267.     shape = 0.7'Rnd
  268.     For sz = .25 To size Step .25
  269.         cl = cl + .05
  270.         Circle (hx, 599), sz, _RGB32(10, cl, 20), , , shape
  271.     Next sz
  272.  
  273. function max(a, b)
  274.         if a > b then max = a else max = b'+
  275.  
  276. '//interpolation code by rattrapmax6
  277. Sub MakePalette (sr, sg, sb, er, eg, eb) ' (b+) start and end RGB's ? yes
  278.     Dim i, istart(3), iend(3), ishow(3), rend(3), interpol(3)
  279.  
  280.     interpol(0) = 255
  281.     istart(1) = sr
  282.     istart(2) = sg
  283.     istart(3) = sb
  284.     iend(1) = er
  285.     iend(2) = eg
  286.     iend(3) = eb
  287.     interpol(1) = (istart(1) - iend(1)) / interpol(0)
  288.     interpol(2) = (istart(2) - iend(2)) / interpol(0)
  289.     interpol(3) = (istart(3) - iend(3)) / interpol(0)
  290.     rend(1) = istart(1)
  291.     rend(2) = istart(2)
  292.     rend(3) = istart(3)
  293.  
  294.     For i = 0 To 255
  295.         ishow(1) = rend(1)
  296.         ishow(2) = rend(2)
  297.         ishow(3) = rend(3)
  298.  
  299.         pal(i) = _RGB32(ishow(1), ishow(2), ishow(3))
  300.  
  301.         rend(1) = rend(1) - interpol(1)
  302.         rend(2) = rend(2) - interpol(2)
  303.         rend(3) = rend(3) - interpol(3)
  304.     Next i
  305.  
  306. '//generates random noise.
  307. Sub GenerateNoise ()
  308.     Dim As Long x, y
  309.  
  310.     For x = 0 To nn * twidth - 1
  311.         For y = 0 To theight - 1
  312.             zz = Rnd
  313.             noise(x + y * twidth) = zz
  314.         Next y
  315.     Next x
  316.  
  317.  
  318. Function SmoothNoise (x, y)
  319.     '//get fractional part of x and y
  320.     Dim fractx, fracty, x1, y1, x2, y2, value
  321.     fractx = x - Int(x)
  322.     fracty = y - Int(y)
  323.  
  324.     '//wrap around
  325.     x1 = (Int(x) + nn * twidth) Mod twidth
  326.     y1 = (Int(y) + theight) Mod theight
  327.  
  328.     '//neighbor values
  329.     x2 = (x1 + nn * twidth - 1) Mod twidth
  330.     y2 = (y1 + theight - 1) Mod theight
  331.  
  332.     '//smooth the noise with bilinear interpolation
  333.     value = 0.0
  334.     value = value + fractx * fracty * noise(x1 + y1 * twidth)
  335.     value = value + fractx * (1 - fracty) * noise(x1 + y2 * twidth)
  336.     value = value + (1 - fractx) * fracty * noise(x2 + y1 * twidth)
  337.     value = value + (1 - fractx) * (1 - fracty) * noise(x2 + y2 * twidth)
  338.  
  339.     SmoothNoise = value
  340.  
  341. Function Turbulence (x, y, size)
  342.     Dim value, initialsize
  343.  
  344.     initialsize = size
  345.     While (size >= 1)
  346.         value = value + SmoothNoise(x / size, y / size) * size
  347.         size = size / 2.0
  348.     Wend
  349.     Turbulence = (128.0 * value / initialsize)
  350.  
  351. '//builds the texture.
  352. Sub buildtexture
  353.     Dim x, y
  354.  
  355.     For x = 0 To nn * twidth - 1
  356.         For y = 0 To theight - 1
  357.             texture(x + y * nn * twidth) = Turbulence(x, y, zoom)
  358.         Next y
  359.     Next x
  360.  
  361. '//draws texture to screen.
  362. Sub drawtexture (dx)
  363.     Dim x, y
  364.     Dim As Long c, r, g, b
  365.  
  366.     For x = 0 To twidth - 1
  367.         For y = 0 To theight - 1
  368.             c = pal(texture(((x + dx) + y * nn * twidth)))
  369.             r = _Red(c)
  370.             g = _Green(c)
  371.             b = _Blue(c)
  372.             c = _RGB(r - 0.2 * y, g - 0.2 * y, b - 0.2 * b)
  373.             PSet (x, y), c 'pal(texture(((x + dx) + y * nn*twidth)))
  374.         Next y
  375.     Next x
  376.  

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Ken's U.S. Flag version 4 - With moving clouds
« Reply #19 on: February 12, 2022, 06:10:20 pm »
LOL Vince, looks like a Pirates Flag in the U.S. I like how the hills also move.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Ken's U.S. Flag version 4 - With moving clouds
« Reply #20 on: February 12, 2022, 06:43:44 pm »
@vince I offer a different way to move the hills:
Code: QB64: [Select]
  1. _Title "Drawlandscape Parallax test" 'started 2019-03-27
  2. 'test if can get end of landscape level to start for big looping background
  3. '2019-03-27 a more gentle adjustment back to Mountain starting height for
  4. 'more seamless connect of back end to front
  5. '2019-03-27 start this file with parallax drawing test
  6.  
  7.  
  8. Screen _NewImage(800, 600, 32)
  9. _ScreenMove 100, 20
  10. Type parallaxType
  11.     handle As Long
  12.     rate As Single 'number of pixels per frame added to le (leading edge)
  13.     le As Single
  14. nLevels = 6
  15. Dim Shared para(1 To nLevels) As parallaxType
  16.  
  17. Dim Shared scape&
  18. LoadLandscape
  19. scapeWidth = _Width(para(1).handle)
  20. scapeHeight = _Height(para(1).handle)
  21.  
  22. While t < 6000
  23.     Cls
  24.     For i = 1 To nLevels
  25.         If para(i).le + 800 > scapeWidth Then
  26.             te = scapeWidth - para(i).le
  27.             _PutImage (0, 0)-(te, scapeHeight), para(i).handle, 0, (scapeWidth - te, 0)-(scapeWidth, scapeHeight)
  28.             _PutImage (te, 0)-(800, scapeHeight), para(i).handle, 0, (0, 0)-(800 - te, scapeHeight)
  29.  
  30.         Else
  31.             _PutImage (0, 0)-(800, scapeHeight), para(i).handle, 0, (para(i).le, 0)-(para(i).le + 800, scapeHeight)
  32.         End If
  33.  
  34.         para(i).le = para(i).le - para(i).rate
  35.         If para(i).le < 0 Then para(i).le = scapeWidth
  36.     Next
  37.     t = t + 1
  38.     _Display
  39.     _Limit 120
  40.  
  41. Sub LoadLandscape
  42.     cur& = _Dest
  43.     xmax = 800 * 3.25: ymax = 600
  44.     hdl& = 1
  45.     para(hdl&).handle = _NewImage(xmax, ymax, 32)
  46.     _Dest para(hdl&).handle
  47.  
  48.     For i = 0 To ymax
  49.         midInk 0, 0, 128, 128, 128, 200, i / ymax
  50.         Line (0, i)-(xmax, i)
  51.     Next
  52.     'the land
  53.     startH = ymax - 200
  54.     rr = 70: gg = 70: bb = 90
  55.     For mountain = 1 To nLevels
  56.         If mountain > 1 Then
  57.             para(mountain).handle = _NewImage(xmax, ymax, 32)
  58.             _Dest para(mountain).handle
  59.         End If
  60.         Xright = 0
  61.         y = startH
  62.         Color _RGB(rr, gg, bb)
  63.         While Xright < xmax - 50
  64.             ' upDown = local up / down over range, change along Y
  65.             ' range = how far up / down, along X
  66.             upDown = (Rnd * .8 - .4) * (mountain * .5)
  67.             range = Xright + rand%(15, 25) * 2.5 / mountain
  68.             If range > xmax - 50 Then range = xmax - 50
  69.             lastx = Xright - 1
  70.             For x = Xright To range 'need less flat tops
  71.                 test = y + upDown
  72.                 test2 = y - upDown
  73.                 If Abs(test - startH) < .13 * startH Then y = test Else y = test2: upDown = -upDown
  74.                 Line (lastx, y)-(x, ymax), , BF 'just lines weren't filling right
  75.                 lastx = x
  76.             Next
  77.             Xright = range
  78.         Wend
  79.         x = lastx + 1
  80.         dy = (startH - y) / 50 'more gentle adjustment back to start of screen
  81.         While x <= xmax
  82.             y = y + dy
  83.             Line (lastx, y)-(x, ymax), , BF 'just lines weren't filling right
  84.             lastx = x
  85.             x = x + 1
  86.         Wend
  87.         rr = rand%(rr - 15, rr): gg = rand%(gg - 15, gg): bb = rand%(bb - 25, bb)
  88.         If rr < 0 Then rr = 0
  89.         If gg < 0 Then gg = 0
  90.         If bb < 0 Then bb = 0
  91.         startH = startH + mountain * rand%(2, 10)
  92.         para(mountain).le = xmax - 800
  93.         para(mountain).rate = mountain * .5
  94.     Next
  95.     _Dest cur&
  96.  
  97. Function rand% (lo%, hi%)
  98.     rand% = Int(Rnd * (hi% - lo% + 1)) + lo%
  99.  
  100. Sub midInk (r1%, g1%, b1%, r2%, g2%, b2%, fr##)
  101.     Color _RGB(r1% + (r2% - r1%) * fr##, g1% + (g2% - g1%) * fr##, b1% + (b2% - b1%) * fr##)
  102.  
  103.