Author Topic: Star Backgound  (Read 32708 times)

0 Members and 1 Guest are viewing this topic.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Star Backgound
« Reply #75 on: July 01, 2018, 04:43:18 pm »
There ya go. I'm glad at least one of us remembered my typo... lol (by the way... I just checked... it's still ticked... lol)

J
Logic is the beginning of wisdom.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Star Backgound
« Reply #76 on: October 31, 2018, 03:18:09 pm »
Vastly improved Sphere Sim:
Code: QB64: [Select]
  1. _TITLE "Fake sphere mapping by Paul Dunn, trans from SpecBas to QB64 2018-10-31 B+"
  2. '10  Fake sphere mapping
  3. '20 GRAPHIC NEW t LOAD "demos:3d/lava_strip.png":gw=gfxw t,gh=gfxh t:
  4. '   palette copy t,0,256 to 0:
  5. '   paper rgbn(0):
  6. '   screen lock
  7. '30 r=scrh/2.1,xc=SCRw/2,yc=SCRh/2,xo=0:
  8. '   do:
  9. '      for y=-r+1 to r-1:
  10. '         x1=sqr(r*r-y*y),
  11. '         tv=(asn(y/r)+1.5)/3:
  12. '         for x=-x1 to x1:
  13. '            tu=(asn(x/x1)+1.5)/6:
  14. '            plot ink gpoint(t,(xo+tu*gw) mod gw,tv*gh);x+xc,y+yc:
  15. '         next x:
  16. '      next y:
  17. '      xo+=1,xo%=gw:
  18. '      wait screen:
  19. '      cls:
  20. '   loop
  21.  
  22. SCREEN _NEWIMAGE(800, 600, 32)
  23. surface& = _LOADIMAGE("martian.png")
  24. 'surface& = _LOADIMAGE("mars.png") 'this image has a color change where ends meet
  25. 'surface& = _LOADIMAGE("mars0.jpeg") 'better
  26.  
  27. gw = _WIDTH(surface&)
  28. gh = _HEIGHT(surface&)
  29. map& = _NEWIMAGE(gw, gh, 32)
  30. _DEST map&
  31. _PUTIMAGE , surface&, map&
  32.  
  33. stars& = _LOADIMAGE("stars.png")
  34. _SOURCE stars&
  35.  
  36. r = _HEIGHT / 3
  37. xc = _WIDTH / 2
  38. yc = _HEIGHT / 2
  39. xo = 0
  40.     FOR y = -r TO r
  41.         x1 = SQR(r * r - y * y)
  42.         tv = (_ASIN(y / r) + 1.5) / 3
  43.         FOR x = -x1 + 1 TO x1
  44.             tu = (_ASIN(x / x1) + 1.5) / 6
  45.             _SOURCE map&
  46.             pc~& = POINT((xo + tu * gw) MOD gw, tv * gh)
  47.             _DEST 0
  48.             PSET (x + xc, y + yc), pc~&
  49.             'plot ink gpoint(t,(xo+tu*gw) mod gw,tv*gh);x+xc,y+yc
  50.         NEXT x
  51.     NEXT y
  52.     xo = xo + 1
  53.     xo = xo MOD gw
  54.     _DISPLAY
  55.     _LIMIT 60
  56.     ' wait screen
  57.     'CLS
  58.  
  59.  
Fake sphere polar crators fixed.PNG
* Fake sphere polar crators fixed.PNG (Filesize: 760.81 KB, Dimensions: 802x626, Views: 412)
* images.zip (Filesize: 3.25 MB, Downloads: 300)
« Last Edit: October 31, 2018, 03:23:52 pm by bplus »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Star Backgound
« Reply #77 on: August 18, 2019, 01:32:33 am »
Well, I decided to make my own Solar System. This time with an orbiting Moon. The movement around the Earth wasn't the hard part like I thought. But the relative speed going around the Earth compared to the speed of Earth going around the Sun is where I'm stuck. The main problem is that I don't know this kind of math. It's the same math I used in my Math Graphics program. But I've tried pretty much everything. I know the Earth moves at the same speed as the Moon going around the Sun, but I can't get the speed of the Moon right. Is there any math people out there that could help me with 1 equation? I know the Moon orbits the Earth 13 times a year and I tried that but it keeps staying on around 10 for some reason. Any help is appreciated, thanks. I'm sure a couple of the lines are wrong in the same area, for the Moon. The other planets I think are OK.

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(800, 600, 32)
  2. one:
  3. _LIMIT 500
  4. mercury = 0.241
  5. venus = 0.6152
  6. mars = 1.8809
  7. moon = 12.368
  8. seconds = seconds + .01
  9. moonseconds = moonseconds + .0013
  10. s = (60 - seconds) * 6 + 180
  11. s1 = (60 - seconds) * 6 + 180 / mercury
  12. s2 = (60 - seconds) * 6 + 180 / venus
  13. s3 = (60 - seconds) * 6 + 180 / mars
  14. s4 = (60 - moonseconds) * 6 + 180
  15.  
  16.  
  17. x1 = INT(SIN(s1 / 45 * 3.141592) * 45) + 400
  18. y1 = INT(COS(s1 / 45 * 3.141592) * 45) + 300
  19.  
  20. x2 = INT(SIN(s2 / 90 * 3.141592) * 90) + 400
  21. y2 = INT(COS(s2 / 90 * 3.141592) * 90) + 300
  22.  
  23. x = INT(SIN(s / 180 * 3.141592) * 180) + 400
  24. y = INT(COS(s / 180 * 3.141592) * 180) + 300
  25.  
  26. x3 = INT(SIN(s3 / 270 * 3.141592) * 270) + 400
  27. y3 = INT(COS(s3 / 270 * 3.141592) * 270) + 300
  28.  
  29. 'Moon
  30. x4 = INT(SIN(s / 18 * 3.141592) * 18) + x
  31. y4 = INT(COS(s / 18 * 3.141592) * 18) + y
  32.  
  33.  
  34.  
  35. CIRCLE (x1, y1), 5, _RGB32(120, 98, 102)
  36. PAINT (x1, y1), _RGB32(120, 98, 102)
  37.  
  38. CIRCLE (x2, y2), 5, _RGB32(161, 67, 39)
  39. PAINT (x2, y2), _RGB32(161, 67, 39)
  40.  
  41. CIRCLE (x, y), 5, _RGB32(0, 0, 255)
  42. PAINT (x, y), _RGB32(0, 0, 255)
  43.  
  44.  
  45. CIRCLE (x3, y3), 5, _RGB32(240, 72, 22)
  46. PAINT (x3, y3), _RGB32(240, 72, 22)
  47.  
  48. 'Moon
  49. CIRCLE (x4, y4), 2.5, _RGB32(179, 179, 181)
  50. PAINT (x4, y4), _RGB32(179, 179, 181)
  51.  
  52.  
  53.  
  54. CIRCLE (400, 300), 10, _RGB32(249, 240, 22)
  55. PAINT (400, 300), _RGB32(249, 240, 22)
  56. IF seconds > 99999 THEN
  57.     CLS
  58.     seconds = 0
  59.     GOTO one:
  60. '_DELAY .001
  61. GOTO one:
  62.  
  63.  
  64.  

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: Star Backgound
« Reply #78 on: August 18, 2019, 03:08:14 am »
Welp, I tried solving this from the ground up and ended up reaching for a full-blown n-layers-deep parent-body simulation, and said "this does NOT help this guy", so I scrapped it entirely and went back to your code.

I'm not sure what inspired some of the mathematical decisions here, but if you want the moon to go around 13 times a year, this got me closer:

Code: QB64: [Select]
  1. SCREEN _NEWIMAGE(800, 600, 32)
  2. one:
  3. _LIMIT 500
  4. mercury = 0.241
  5. venus = 0.6152
  6. mars = 1.8809
  7. moon = 12.368
  8. seconds = seconds + .01
  9. moonseconds = moonseconds + .01
  10. s = (60 - seconds) * 6 + 180
  11. s1 = (60 - seconds) * 6 + 180 / mercury
  12. s2 = (60 - seconds) * 6 + 180 / venus
  13. s3 = (60 - seconds) * 6 + 180 / mars
  14. s4 = (60 - moonseconds) * 6 + 180
  15.  
  16.  
  17. x1 = INT(SIN(s1 / 45 * 3.141592) * 45) + 400
  18. y1 = INT(COS(s1 / 45 * 3.141592) * 45) + 300
  19.  
  20. x2 = INT(SIN(s2 / 90 * 3.141592) * 90) + 400
  21. y2 = INT(COS(s2 / 90 * 3.141592) * 90) + 300
  22.  
  23. x = INT(SIN(s / 180 * 3.141592) * 180) + 400
  24. y = INT(COS(s / 180 * 3.141592) * 180) + 300
  25.  
  26. x3 = INT(SIN(s3 / 270 * 3.141592) * 270) + 400
  27. y3 = INT(COS(s3 / 270 * 3.141592) * 270) + 300
  28.  
  29. 'Moon
  30. x4 = INT(SIN(19 * s3 / 270 * 3.141592) * 18) + x
  31. y4 = INT(COS(19 * s3 / 270 * 3.141592) * 18) + y
  32.  
  33. CIRCLE (x1, y1), 5, _RGB32(120, 98, 102)
  34. PAINT (x1, y1), _RGB32(120, 98, 102)
  35.  
  36. CIRCLE (x2, y2), 5, _RGB32(161, 67, 39)
  37. PAINT (x2, y2), _RGB32(161, 67, 39)
  38.  
  39. CIRCLE (x, y), 5, _RGB32(0, 0, 255)
  40. PAINT (x, y), _RGB32(0, 0, 255)
  41.  
  42.  
  43. CIRCLE (x3, y3), 5, _RGB32(240, 72, 22)
  44. PAINT (x3, y3), _RGB32(240, 72, 22)
  45.  
  46. 'Moon
  47. CIRCLE (x4, y4), 2.5, _RGB32(179, 179, 181)
  48. PAINT (x4, y4), _RGB32(179, 179, 181)
  49.  
  50.  
  51.  
  52. CIRCLE (400, 300), 10, _RGB32(249, 240, 22)
  53. PAINT (400, 300), _RGB32(249, 240, 22)
  54. IF seconds > 99999 THEN
  55.     CLS
  56.     seconds = 0
  57.     GOTO one:
  58. '_DELAY .001
  59. GOTO one:
  60.  
You're not done when it works, you're done when it's right.

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: Star Backgound
« Reply #79 on: August 18, 2019, 07:57:08 am »
The planets in my program are moving "on rails" as well. https://www.qb64.org/forum/index.php?topic=1429.0 That is, the program is not using a gravitational equation. Now the first thing that jumps out at me is that you are assigning almost the exact same numbers to the planets that I did, except the Moon is radically different. The planets are done using the orbital period in years per revolution, while the Moon is using revolutions per year. I'd suggest not treating the moon as a special case, with "moonseconds" as opposed to "seconds", require that it conform to one universal equation. I'll see what I can come up with and post when done. I type rather slowly...

Try this...

By changing p and adding appropriate data, you can easily add more moons and planets.
Code: QB64: [Select]
  1. TYPE planet
  2.     nam AS STRING * 10
  3.     parent AS STRING * 10
  4.     x AS INTEGER
  5.     y AS INTEGER
  6.     s AS SINGLE
  7.     orad AS INTEGER
  8.     oprd AS SINGLE
  9.     rad AS SINGLE
  10.     r AS INTEGER
  11.     g AS INTEGER
  12.     b AS INTEGER
  13.  
  14. p = 6 '                                                         change p to equal number of planets/satellites
  15.  
  16. REDIM SHARED exo(p) AS planet
  17.  
  18. FOR a = 1 TO p
  19.     READ exo(a).nam
  20.     READ exo(a).parent
  21.     READ exo(a).x
  22.     READ exo(a).y
  23.     READ exo(a).orad
  24.     READ exo(a).oprd
  25.     READ exo(a).rad
  26.     READ exo(a).r
  27.     READ exo(a).g
  28.     READ exo(a).b
  29.  
  30. DATA "Sol","Sol",400,300,0,0,5,249,240,22
  31. DATA "Mercury","Sol",0,0,45,0.241,5,120,98,102
  32. DATA "Venus","Sol",0,0,90,0.6152,5,161,67,39
  33. DATA "Earth","Sol",0,0,180,1,5,0,0,255
  34. DATA "Mars","Sol",0,0,270,1.8809,5,240,72,22
  35. DATA "Moon","Earth",0,0,18,0.0748,2.5,179,179,181
  36.  
  37. SCREEN _NEWIMAGE(800, 600, 32)
  38. one:
  39. _LIMIT 500
  40. seconds = seconds + .01
  41. b = 1
  42. CIRCLE (exo(b).x, exo(b).y), exo(b).rad, _RGB32(exo(b).r, exo(b).g, exo(b).b)
  43. PAINT (exo(b).x, exo(b).y), _RGB32(exo(b).r, exo(b).g, exo(b).b)
  44.  
  45. FOR b = 2 TO p
  46.     exo(b).s = (60 - seconds) * 6 + 180 / exo(b).oprd
  47.     exo(b).x = INT(SIN(_D2R(exo(b).s / exo(b).oprd)) * exo(b).orad) + exo(FindParent(b)).x
  48.     exo(b).y = INT(COS(_D2R(exo(b).s / exo(b).oprd)) * exo(b).orad) + exo(FindParent(b)).y
  49.     CIRCLE (exo(b).x, exo(b).y), exo(b).rad, _RGB32(exo(b).r, exo(b).g, exo(b).b)
  50.     PAINT (exo(b).x, exo(b).y), _RGB32(exo(b).r, exo(b).g, exo(b).b)
  51. IF seconds > 99999 THEN
  52.     CLS
  53.     seconds = 0
  54.     GOTO one:
  55. '_DELAY .001
  56. GOTO one:
  57.  
  58. FUNCTION FindParent (var AS INTEGER)
  59.  
  60.     'Accepts a planetary body index (var) and finds the index of its parent body
  61.  
  62.     FOR x = 1 TO p
  63.         IF exo(var).parent = exo(x).nam THEN o = x
  64.     NEXT x
  65.     FindParent = o
  66.  
  67. END FUNCTION 'FindParent
  68.  
  69.  
« Last Edit: August 18, 2019, 09:22:42 am by OldMoses »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Star Backgound
« Reply #80 on: August 18, 2019, 11:34:28 am »
LOL thanks STxAxTIC! Was easier than I thought. I'm going to stick with your way since it's just about all my code and it will be on my website. Thank you also OldMoses, but the way you program, using TYPE and broken up variables, etc. I just haven't reached that level of expertise yet. STxAxTIC I added your nick to the top of the code. I'll put that on my website probably sometime today, unless I play around with it more. Oh and yes, I used orbital numbers compared to Earth's orbit for other planets. I think I was just thinking too much about this. The Earth and Moon go around the sun in equal time, so just use equal numbers.
« Last Edit: August 18, 2019, 11:48:20 am by SierraKen »

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: Star Backgound
« Reply #81 on: August 18, 2019, 12:06:35 pm »
Thank you also OldMoses, but the way you program, using TYPE and broken up variables, etc. I just haven't reached that level of expertise yet.

If you only knew the power of the Darkside....and we have cookies. ;)

Seriously though, you should try playing around with it some, it's really not as complex as it may seem. You owe it to yourself to push your skills in that direction.

I know you've been doing some fairly sophisticated programming, some of which I can't grasp on a casual reading, so I believe you will not find the concepts difficult. A well designed type array makes adding elements a breeze without a lot of code revision, and is easy to modify if needed. If anything, the variables are less "broken up", and one can keep indexed data ordered easier. You'll be astonished at what you can do with a very small amount of code once the infrastructure is there.

As an illustration, I added the moons of Mars (Phobos & Deimos) to the code. The only thing necessary was to change p from 6 to 8, and to add two data lines for the moons. Since their orbital periods are so fast, I slowed them down by a factor of 100, to make them easier on the eyes.

Code: QB64: [Select]
  1. TYPE planet
  2.     nam AS STRING * 10
  3.     parent AS STRING * 10
  4.     x AS INTEGER
  5.     y AS INTEGER
  6.     s AS SINGLE
  7.     orad AS INTEGER
  8.     oprd AS SINGLE
  9.     rad AS SINGLE
  10.     r AS INTEGER
  11.     g AS INTEGER
  12.     b AS INTEGER
  13.  
  14. p = 8 '                                                         change p to equal number of planets/satellites
  15.  
  16. REDIM SHARED exo(p) AS planet
  17.  
  18. FOR a = 1 TO p
  19.     READ exo(a).nam
  20.     READ exo(a).parent
  21.     READ exo(a).x
  22.     READ exo(a).y
  23.     READ exo(a).orad
  24.     READ exo(a).oprd
  25.     READ exo(a).rad
  26.     READ exo(a).r
  27.     READ exo(a).g
  28.     READ exo(a).b
  29.  
  30. DATA "Sol","Sol",400,300,0,0,5,249,240,22
  31. DATA "Mercury","Sol",0,0,45,0.241,5,120,98,102
  32. DATA "Venus","Sol",0,0,90,0.6152,5,161,67,39
  33. DATA "Earth","Sol",0,0,180,1,5,0,0,255
  34. DATA "Mars","Sol",0,0,270,1.8809,5,240,72,22
  35. DATA "Moon","Earth",0,0,18,0.0748,2.5,179,179,181
  36. DATA "Phobos","Mars",0,0,10,0.0873,1.5,179,179,181
  37. DATA "Deimos","Mars",0,0,30,0.3458,1.5,179,179,181
  38.  
  39. SCREEN _NEWIMAGE(800, 600, 32)
  40. one:
  41. _LIMIT 500
  42. seconds = seconds + .01
  43. b = 1
  44. CIRCLE (exo(b).x, exo(b).y), exo(b).rad, _RGB32(exo(b).r, exo(b).g, exo(b).b)
  45. PAINT (exo(b).x, exo(b).y), _RGB32(exo(b).r, exo(b).g, exo(b).b)
  46.  
  47. FOR b = 2 TO p
  48.     exo(b).s = (60 - seconds) * 6 + 180 / exo(b).oprd
  49.     exo(b).x = INT(SIN(_D2R(exo(b).s / exo(b).oprd)) * exo(b).orad) + exo(FindParent(b)).x
  50.     exo(b).y = INT(COS(_D2R(exo(b).s / exo(b).oprd)) * exo(b).orad) + exo(FindParent(b)).y
  51.     CIRCLE (exo(b).x, exo(b).y), exo(b).rad, _RGB32(exo(b).r, exo(b).g, exo(b).b)
  52.     PAINT (exo(b).x, exo(b).y), _RGB32(exo(b).r, exo(b).g, exo(b).b)
  53. IF seconds > 99999 THEN
  54.     CLS
  55.     seconds = 0
  56.     GOTO one:
  57. '_DELAY .001
  58. GOTO one:
  59.  
  60. FUNCTION FindParent (var AS INTEGER)
  61.  
  62.     'Accepts a planetary body index (var) and finds the index of its parent body
  63.  
  64.     FOR x = 1 TO p
  65.         IF exo(var).parent = exo(x).nam THEN o = x
  66.     NEXT x
  67.     FindParent = o
  68.  
  69. END FUNCTION 'FindParent
  70.  
« Last Edit: August 18, 2019, 12:35:41 pm by OldMoses »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Star Backgound
« Reply #82 on: August 18, 2019, 06:24:04 pm »
I decided to make my own Solar System Simulator. It has all the planets. It doesn't have Pluto for 2 reasons, one is that Pluto is now a Kupier Belt Object instead of a regular planet, but mostly also because Pluto's orbit is way too hard to calculate. I looked up equations for it online and someone even says it has never been done by anyone and been verified, because it's an elongated orbit going in and out of Neptune's orbit and also it's not the the same vertical plane as the rest of the Solar System. The awesome thing about my little program is that it uses the mouse to zoom in and out to see the rest of the planets (using the mouse wheel) and it also identifies the objects when you put your mouse over them (except The Moon since it's too close to Earth). Check out my funky Saturn. :) By the way, I don't mean to try to be better than anyone else in here with my programming, I just get ideas and go with it. And I think all of us do that. I hope anyway.

(Better version is after this one which has viewing tilt.)

Code: QB64: [Select]
  1. 'Ken G. made thie program on August 18, 2019,
  2. 'Thank you to STxAxTIC on the QB64.org forum for a little bit of help with the Moon orbit!
  3.  
  4. _TITLE "Solar System Simulator by Ken G. - Use Mouse To Identify and Mouse Wheel To Zoom In and Out For More Planets"
  5. SCREEN _NEWIMAGE(800, 600, 32)
  6. mercury = 0.241
  7. venus = 0.6152
  8. mars = 1.8809
  9. jupiter = 11.8618
  10. saturn = 29.457
  11. uranus = 84.0205
  12. neptune = 164.8
  13. pluto = 248
  14. angle = 180
  15. one:
  16. _LIMIT 500
  17. mouseWheel = 0
  18.     mouseX = _MOUSEX
  19.     mouseY = _MOUSEY
  20.     mouseLeftButton = _MOUSEBUTTON(1)
  21.     mouseRightButton = _MOUSEBUTTON(2)
  22.     mouseMiddleButton = _MOUSEBUTTON(3)
  23.     mouseWheel = mouseWheel + _MOUSEWHEEL
  24. IF mouseWheel < 0 THEN angle = angle - 10
  25. IF mouseWheel > 0 THEN angle = angle + 10
  26.  
  27. IF mouseX > 385 AND mouseX < 415 AND mouseY > 285 AND mouseY < 315 THEN LOCATE 2, 49: PRINT "Sun    "
  28. IF mouseX > x1 - 15 AND mouseX < x1 + 15 AND mouseY > y1 - 15 AND mouseY < y1 + 15 THEN LOCATE 2, 49: PRINT "Mercury"
  29. IF mouseX > x2 - 15 AND mouseX < x2 + 15 AND mouseY > y2 - 15 AND mouseY < y2 + 15 THEN LOCATE 2, 49: PRINT "Venus  "
  30. IF mouseX > x - 15 AND mouseX < x + 15 AND mouseY > y - 15 AND mouseY < y + 15 THEN LOCATE 2, 49: PRINT "Earth  "
  31. IF mouseX > x3 - 15 AND mouseX < x3 + 15 AND mouseY > y3 - 15 AND mouseY < y3 + 15 THEN LOCATE 2, 49: PRINT "Mars   "
  32. IF mouseX > x5 - 15 AND mouseX < x5 + 15 AND mouseY > y5 - 15 AND mouseY < y5 + 15 THEN LOCATE 2, 49: PRINT "Jupiter"
  33. IF mouseX > x6 - 15 AND mouseX < x6 + 15 AND mouseY > y6 - 15 AND mouseY < y6 + 15 THEN LOCATE 2, 49: PRINT "Saturn "
  34. IF mouseX > x7 - 15 AND mouseX < x7 + 15 AND mouseY > y7 - 15 AND mouseY < y7 + 15 THEN LOCATE 2, 49: PRINT "Uranus "
  35. IF mouseX > x8 - 15 AND mouseX < x8 + 15 AND mouseY > y8 - 15 AND mouseY < y8 + 15 THEN LOCATE 2, 49: PRINT "Neptune"
  36.  
  37.  
  38. a$ = INKEY$
  39. IF a$ = CHR$(27) THEN END
  40. IF a$ = CHR$(0) + CHR$(72) THEN angle = angle + 10
  41. IF a$ = CHR$(0) + CHR$(80) THEN angle = angle - 10
  42. IF angle > 360 THEN angle = 360
  43. IF angle < 0 THEN angle = 0
  44.  
  45. seconds = seconds + .01
  46.  
  47. s1 = (60 - seconds) * 6 + 180 / mercury
  48. s2 = (60 - seconds) * 6 + 180 / venus
  49. s3 = (60 - seconds) * 6 + 180 'Earth and Moon
  50. s4 = (60 - seconds) * 6 + 180 / mars
  51. s5 = (60 - seconds) * 6 + 180 / jupiter
  52. s6 = (60 - seconds) * 6 + 180 / saturn
  53. s7 = (60 - seconds) * 6 + 180 / uranus
  54. s8 = (60 - seconds) * 6 + 180 / neptune
  55.  
  56. 'Mercury
  57. x1 = INT(SIN(s1 / 45 * 3.141592) * angle / 4) + 400
  58. y1 = INT(COS(s1 / 45 * 3.141592) * angle / 4) + 300
  59.  
  60. 'Venus
  61. x2 = INT(SIN(s2 / 90 * 3.141592) * angle / 2) + 400
  62. y2 = INT(COS(s2 / 90 * 3.141592) * angle / 2) + 300
  63.  
  64. 'Earth
  65. x = INT(SIN(s3 / 180 * 3.141592) * angle) + 400
  66. y = INT(COS(s3 / 180 * 3.141592) * angle) + 300
  67.  
  68. 'Mars
  69. x3 = INT(SIN(s4 / 270 * 3.141592) * angle * 1.5) + 400
  70. y3 = INT(COS(s4 / 270 * 3.141592) * angle * 1.5) + 300
  71.  
  72. 'Moon
  73. x4 = INT(SIN(19 * s3 / 270 * 3.141592) * angle / 10) + x
  74. y4 = INT(COS(19 * s3 / 270 * 3.141592) * angle / 10) + y
  75.  
  76. 'Outer Planets
  77. 'Jupiter
  78. x5 = INT(SIN(s5 / 450 * 3.141592) * angle * 3) + 400
  79. y5 = INT(COS(s5 / 450 * 3.141592) * angle * 3) + 300
  80.  
  81. 'Saturn
  82. x6 = INT(SIN(s6 / 630 * 3.141592) * angle * 4.5) + 400
  83. y6 = INT(COS(s6 / 630 * 3.141592) * angle * 4.5) + 300
  84.  
  85. 'Uranus
  86. x7 = INT(SIN(s7 / 810 * 3.141592) * angle * 6) + 400
  87. y7 = INT(COS(s7 / 810 * 3.141592) * angle * 6) + 300
  88.  
  89. 'Neptune
  90. x8 = INT(SIN(s8 / 990 * 3.141592) * angle * 7.5) + 400
  91. y8 = INT(COS(s8 / 990 * 3.141592) * angle * 7.5) + 300
  92.  
  93. 'Mercury
  94. CIRCLE (x1, y1), 5, _RGB32(120, 98, 102)
  95. PAINT (x1, y1), _RGB32(120, 98, 102)
  96.  
  97. 'Venus
  98. CIRCLE (x2, y2), 5, _RGB32(161, 67, 39)
  99. PAINT (x2, y2), _RGB32(161, 67, 39)
  100.  
  101. 'Earth
  102. CIRCLE (x, y), 5, _RGB32(0, 0, 255)
  103. PAINT (x, y), _RGB32(0, 0, 255)
  104.  
  105. 'Mars
  106. CIRCLE (x3, y3), 5, _RGB32(240, 72, 22)
  107. PAINT (x3, y3), _RGB32(240, 72, 22)
  108.  
  109. 'Moon
  110. CIRCLE (x4, y4), 2.5, _RGB32(179, 179, 181)
  111. PAINT (x4, y4), _RGB32(179, 179, 181)
  112.  
  113. 'Outer Planets
  114. 'Jupiter
  115. CIRCLE (x5, y5), 5, _RGB32(255, 166, 127)
  116. PAINT (x5, y5), _RGB32(255, 166, 127)
  117.  
  118. 'Saturn
  119. CIRCLE (x6, y6), 5, _RGB32(255, 127, 127)
  120. PAINT (x6, y6), _RGB32(255, 127, 127)
  121. FOR rings = 1 TO 2
  122.     CIRCLE (x6, y6), 7 + rings, _RGB32(255, 127, 127)
  123. NEXT rings
  124.  
  125. 'Uranus
  126. CIRCLE (x7, y7), 5, _RGB32(127, 166, 255)
  127. PAINT (x7, y7), _RGB32(127, 166, 255)
  128.  
  129. 'Neptune
  130. CIRCLE (x8, y8), 5, _RGB32(0, 78, 255)
  131. PAINT (x8, y8), _RGB32(0, 78, 255)
  132.  
  133. 'Sun
  134. CIRCLE (400, 300), 5, _RGB32(249, 240, 22)
  135. PAINT (400, 300), _RGB32(249, 240, 22)
  136. IF seconds > 99999 THEN
  137.     CLS
  138.     seconds = 0
  139.     GOTO one:
  140. GOTO one:
  141.  
  142.  
« Last Edit: August 18, 2019, 08:55:23 pm by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Star Backgound
« Reply #83 on: August 18, 2019, 08:55:42 pm »
Use Mouse over the planets to I.D. them. Use Mouse Wheel to zoom in and out to all of the planets, and use Up and Down Arrow Keys to tilt the view.

Code: QB64: [Select]
  1. 'Ken G. made thie program on August 18, 2019,
  2. 'Thank you to STxAxTIC on the QB64.org forum for a little bit of help with The Moon orbit!
  3.  
  4. _TITLE "Solar System Simulator by Ken G. Use Mouse Over Planets, Mouse Wheel to Zoom, and Up and Down Arrow Keys To Tilt."
  5. SCREEN _NEWIMAGE(800, 600, 32)
  6. mercury = 0.241
  7. venus = 0.6152
  8. mars = 1.8809
  9. jupiter = 11.8618
  10. saturn = 29.457
  11. uranus = 84.0205
  12. neptune = 164.8
  13. angle = 180
  14. tilt = 1
  15. one:
  16. _LIMIT 500
  17. mouseWheel = 0
  18.     mouseX = _MOUSEX
  19.     mouseY = _MOUSEY
  20.     mouseLeftButton = _MOUSEBUTTON(1)
  21.     mouseRightButton = _MOUSEBUTTON(2)
  22.     mouseMiddleButton = _MOUSEBUTTON(3)
  23.     mouseWheel = mouseWheel + _MOUSEWHEEL
  24. IF mouseWheel < 0 THEN angle = angle - 10
  25. IF mouseWheel > 0 THEN angle = angle + 10
  26.  
  27. IF mouseX > 385 AND mouseX < 415 AND mouseY > 285 AND mouseY < 315 THEN LOCATE 2, 49: PRINT "Sun    "
  28. IF mouseX > x1 - 15 AND mouseX < x1 + 15 AND mouseY > y1 - 15 AND mouseY < y1 + 15 THEN LOCATE 2, 49: PRINT "Mercury"
  29. IF mouseX > x2 - 15 AND mouseX < x2 + 15 AND mouseY > y2 - 15 AND mouseY < y2 + 15 THEN LOCATE 2, 49: PRINT "Venus  "
  30. IF mouseX > x - 15 AND mouseX < x + 15 AND mouseY > y - 15 AND mouseY < y + 15 THEN LOCATE 2, 49: PRINT "Earth  "
  31. IF mouseX > x3 - 15 AND mouseX < x3 + 15 AND mouseY > y3 - 15 AND mouseY < y3 + 15 THEN LOCATE 2, 49: PRINT "Mars   "
  32. IF mouseX > x5 - 15 AND mouseX < x5 + 15 AND mouseY > y5 - 15 AND mouseY < y5 + 15 THEN LOCATE 2, 49: PRINT "Jupiter"
  33. IF mouseX > x6 - 15 AND mouseX < x6 + 15 AND mouseY > y6 - 15 AND mouseY < y6 + 15 THEN LOCATE 2, 49: PRINT "Saturn "
  34. IF mouseX > x7 - 15 AND mouseX < x7 + 15 AND mouseY > y7 - 15 AND mouseY < y7 + 15 THEN LOCATE 2, 49: PRINT "Uranus "
  35. IF mouseX > x8 - 15 AND mouseX < x8 + 15 AND mouseY > y8 - 15 AND mouseY < y8 + 15 THEN LOCATE 2, 49: PRINT "Neptune"
  36.  
  37. a$ = INKEY$
  38. IF a$ = CHR$(27) THEN END
  39. IF a$ = CHR$(0) + CHR$(72) THEN tilt = tilt + 1
  40. IF a$ = CHR$(0) + CHR$(80) THEN tilt = tilt - 1
  41. IF angle > 360 THEN angle = 360
  42. IF angle < 10 THEN angle = 10
  43. IF tilt > 90 THEN tilt = 90
  44. IF tilt < 1 THEN tilt = 1
  45. seconds = seconds + .01
  46. s1 = (60 - seconds) * 6 + 180 / mercury
  47. s2 = (60 - seconds) * 6 + 180 / venus
  48. s3 = (60 - seconds) * 6 + 180 'Earth and Moon
  49. s4 = (60 - seconds) * 6 + 180 / mars
  50. s5 = (60 - seconds) * 6 + 180 / jupiter
  51. s6 = (60 - seconds) * 6 + 180 / saturn
  52. s7 = (60 - seconds) * 6 + 180 / uranus
  53. s8 = (60 - seconds) * 6 + 180 / neptune
  54.  
  55. 'Mercury
  56. x1 = INT(SIN(s1 / 45 * 3.141592) * angle / 4) + 400
  57. y1 = INT(COS(s1 / 45 * 3.141592) * (angle / 4) / tilt) + 300
  58.  
  59. 'Venus
  60. x2 = INT(SIN(s2 / 90 * 3.141592) * angle / 2) + 400
  61. y2 = INT(COS(s2 / 90 * 3.141592) * (angle / 2) / tilt) + 300
  62.  
  63. 'Earth
  64. x = INT(SIN(s3 / 180 * 3.141592) * angle) + 400
  65. y = INT(COS(s3 / 180 * 3.141592) * angle / tilt) + 300
  66.  
  67. 'Mars
  68. x3 = INT(SIN(s4 / 270 * 3.141592) * angle * 1.5) + 400
  69. y3 = INT(COS(s4 / 270 * 3.141592) * (angle * 1.5) / tilt) + 300
  70.  
  71. 'Moon
  72. x4 = INT(SIN(19 * s3 / 270 * 3.141592) * angle / 10) + x
  73. y4 = INT(COS(19 * s3 / 270 * 3.141592) * (angle / 10) / tilt) + y
  74.  
  75. 'Outer Planets
  76. 'Jupiter
  77. x5 = INT(SIN(s5 / 450 * 3.141592) * angle * 3) + 400
  78. y5 = INT(COS(s5 / 450 * 3.141592) * (angle * 3) / tilt) + 300
  79.  
  80. 'Saturn
  81. x6 = INT(SIN(s6 / 630 * 3.141592) * angle * 4.5) + 400
  82. y6 = INT(COS(s6 / 630 * 3.141592) * (angle * 4.5) / tilt) + 300
  83.  
  84. 'Uranus
  85. x7 = INT(SIN(s7 / 810 * 3.141592) * angle * 6) + 400
  86. y7 = INT(COS(s7 / 810 * 3.141592) * (angle * 6) / tilt) + 300
  87.  
  88. 'Neptune
  89. x8 = INT(SIN(s8 / 990 * 3.141592) * angle * 7.5) + 400
  90. y8 = INT(COS(s8 / 990 * 3.141592) * (angle * 7.5) / tilt) + 300
  91.  
  92. 'Mercury
  93. CIRCLE (x1, y1), 5, _RGB32(120, 98, 102)
  94. PAINT (x1, y1), _RGB32(120, 98, 102)
  95.  
  96. 'Venus
  97. CIRCLE (x2, y2), 5, _RGB32(161, 67, 39)
  98. PAINT (x2, y2), _RGB32(161, 67, 39)
  99.  
  100. 'Earth
  101. CIRCLE (x, y), 5, _RGB32(0, 0, 255)
  102. PAINT (x, y), _RGB32(0, 0, 255)
  103.  
  104. 'Mars
  105. CIRCLE (x3, y3), 5, _RGB32(240, 72, 22)
  106. PAINT (x3, y3), _RGB32(240, 72, 22)
  107.  
  108. 'Moon
  109. CIRCLE (x4, y4), 2.5, _RGB32(179, 179, 181)
  110. PAINT (x4, y4), _RGB32(179, 179, 181)
  111.  
  112. 'Outer Planets
  113. 'Jupiter
  114. CIRCLE (x5, y5), 5, _RGB32(255, 166, 127)
  115. PAINT (x5, y5), _RGB32(255, 166, 127)
  116.  
  117. 'Saturn
  118. CIRCLE (x6, y6), 5, _RGB32(255, 127, 127)
  119. PAINT (x6, y6), _RGB32(255, 127, 127)
  120. FOR rings = 1 TO 2
  121.     CIRCLE (x6, y6), 7 + rings, _RGB32(255, 127, 127), , , .65
  122. NEXT rings
  123.  
  124. 'Uranus
  125. CIRCLE (x7, y7), 5, _RGB32(127, 166, 255)
  126. PAINT (x7, y7), _RGB32(127, 166, 255)
  127.  
  128. 'Neptune
  129. CIRCLE (x8, y8), 5, _RGB32(0, 78, 255)
  130. PAINT (x8, y8), _RGB32(0, 78, 255)
  131.  
  132. 'Sun
  133. CIRCLE (400, 300), 5, _RGB32(249, 240, 22)
  134. PAINT (400, 300), _RGB32(249, 240, 22)
  135. IF seconds > 99999 THEN
  136.     CLS
  137.     seconds = 0
  138.     GOTO one:
  139. GOTO one:
  140.  


Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Star Backgound
« Reply #84 on: August 18, 2019, 09:20:13 pm »
Code: [Select]
DO WHILE _MOUSEINPUT
    mouseX = _MOUSEX
    mouseY = _MOUSEY
    mouseLeftButton = _MOUSEBUTTON(1)
    mouseRightButton = _MOUSEBUTTON(2)
    mouseMiddleButton = _MOUSEBUTTON(3)
    mouseWheel = mouseWheel + _MOUSEWHEEL
LOOP

Warning: The code above is very susceptible to causing lag inside a program, and should generally be avoided at all cost.

Move the mouse quickly back and forth across the screen several times and watch how it lags as it keeps reassigning values over and over to all those variables...  mouse starts in far left, moves to far right, that’s several thousand updates to mousex while the mousebuffer is clearing...

Much better is generally:

Code: [Select]
DO WHILE _MOUSEINPUT
    ‘ mouseX = _MOUSEX
    ‘ mouseY = _MOUSEY
    ‘ mouseLeftButton = _MOUSEBUTTON(1)
    ‘ mouseRightButton = _MOUSEBUTTON(2)
    ‘ mouseMiddleButton = _MOUSEBUTTON(3)
    mouseWheel = mouseWheel + _MOUSEWHEEL
LOOP
mouseX = _MOUSEX
mouseY = _MOUSEY
mouseLeftButton = _MOUSEBUTTON(1)
mouseRightButton = _MOUSEBUTTON(2)
mouseMiddleButton = _MOUSEBUTTON(3)

Who cares how many times the mouse registered an x movement of a fraction of a pixel?  What we need to really know is “where is the mouse once that movement stops”.  After all, we’re not actually doing anything by updating the value a zillion times in the previous loop as it moves across the screen — we just keep overwriting mousex and mousey so we know their value once _MOUSEINPUT = 0.

Get the mouse states after the loop, and not during, and prevent the lag issues before they start.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Star Backgound
« Reply #85 on: August 18, 2019, 09:23:39 pm »
Hi Ken,

I like the tilting allot! and am curious where the figures:
Quote
mercury = 0.241
venus = 0.6152
mars = 1.8809
jupiter = 11.8618
saturn = 29.457
uranus = 84.0205
neptune = 164.8
come from?

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Star Backgound
« Reply #86 on: August 18, 2019, 09:27:42 pm »
Thanks! Those figures are comparing those planets with Earth. With Earth as 1 (rotation speed) and the others are all relative to that. Or something like that. lol For example, Mercury flies around the Sun faster than Earth does, so it's less than 1. When you go past Earth, I think I did times instead of division. Speed in the program isn't exact, but I tried. I may have to adjust them.
« Last Edit: August 18, 2019, 09:33:03 pm by SierraKen »

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Star Backgound
« Reply #87 on: August 18, 2019, 09:35:56 pm »
To be exact, those numbers originally came from the Internet, with the real speeds comparing them to Earth.

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Star Backgound
« Reply #88 on: August 18, 2019, 10:42:03 pm »
Well... If we are talking 'exact'... 'Those' figures are the length of time in years (Earth years) for each planet to complete a single orbit around the Sun.

Simply calculating the length of the orbit, 2 * pi * semi-major axis, dividing it by the number of hours it takes to orbit, will give you the planet's orbiting velocity. This method crude at best. The orbit is assumed to be circular.

Mercury: 87.96878448 days at 107,138.4 mph
Venus: 224.6996656 days at 78,367.7 mph
Earth: 365.24 days at 66,661.22 mph

I think I will stop there... my poor little calculator is complaining of keypad stress... lol
Logic is the beginning of wisdom.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Star Backgound
« Reply #89 on: August 19, 2019, 01:23:46 am »
Here is a better version, thanks to B+ for the comments in the other thread. This one hides the planets when they go further away.

Code: QB64: [Select]
  1. 'Ken G. made thie program on August 18, 2019,
  2. 'Thank you to STxAxTIC on the QB64.org forum for a little bit of help with The Moon orbit!
  3.  
  4. _TITLE "Solar System Simulator by Ken G. Use Mouse Over Planets, Mouse Wheel to Zoom, and Up and Down Arrow Keys To Tilt."
  5. SCREEN _NEWIMAGE(800, 600, 32)
  6. DIM z(10)
  7. mercury = 0.241
  8. venus = 0.6152
  9. mars = 1.8809
  10. jupiter = 11.8618
  11. saturn = 29.457
  12. uranus = 84.0205
  13. neptune = 164.8
  14. angle = 180
  15. tilt = 1
  16. one:
  17. _LIMIT 500
  18. mouseWheel = 0
  19.     mouseX = _MOUSEX
  20.     mouseY = _MOUSEY
  21.     mouseLeftButton = _MOUSEBUTTON(1)
  22.     mouseRightButton = _MOUSEBUTTON(2)
  23.     mouseMiddleButton = _MOUSEBUTTON(3)
  24.     mouseWheel = mouseWheel + _MOUSEWHEEL
  25. IF mouseWheel < 0 THEN angle = angle - 10
  26. IF mouseWheel > 0 THEN angle = angle + 10
  27.  
  28. IF mouseX > 385 AND mouseX < 415 AND mouseY > 285 AND mouseY < 315 THEN LOCATE 2, 49: PRINT "Sun    "
  29. IF mouseX > x1 - 15 AND mouseX < x1 + 15 AND mouseY > y1 - 15 AND mouseY < y1 + 15 THEN LOCATE 2, 49: PRINT "Mercury"
  30. IF mouseX > x2 - 15 AND mouseX < x2 + 15 AND mouseY > y2 - 15 AND mouseY < y2 + 15 THEN LOCATE 2, 49: PRINT "Venus  "
  31. IF mouseX > x - 15 AND mouseX < x + 15 AND mouseY > y - 15 AND mouseY < y + 15 THEN LOCATE 2, 49: PRINT "Earth  "
  32. IF mouseX > x3 - 15 AND mouseX < x3 + 15 AND mouseY > y3 - 15 AND mouseY < y3 + 15 THEN LOCATE 2, 49: PRINT "Mars   "
  33. IF mouseX > x5 - 15 AND mouseX < x5 + 15 AND mouseY > y5 - 15 AND mouseY < y5 + 15 THEN LOCATE 2, 49: PRINT "Jupiter"
  34. IF mouseX > x6 - 15 AND mouseX < x6 + 15 AND mouseY > y6 - 15 AND mouseY < y6 + 15 THEN LOCATE 2, 49: PRINT "Saturn "
  35. IF mouseX > x7 - 15 AND mouseX < x7 + 15 AND mouseY > y7 - 15 AND mouseY < y7 + 15 THEN LOCATE 2, 49: PRINT "Uranus "
  36. IF mouseX > x8 - 15 AND mouseX < x8 + 15 AND mouseY > y8 - 15 AND mouseY < y8 + 15 THEN LOCATE 2, 49: PRINT "Neptune"
  37.  
  38. a$ = INKEY$
  39. IF a$ = CHR$(27) THEN END
  40. IF a$ = CHR$(0) + CHR$(72) THEN tilt = tilt + 1
  41. IF a$ = CHR$(0) + CHR$(80) THEN tilt = tilt - 1
  42. IF angle > 360 THEN angle = 360
  43. IF angle < 10 THEN angle = 10
  44. IF tilt > 30 THEN tilt = 30
  45. IF tilt < 1 THEN tilt = 1
  46. seconds = seconds + .01
  47. s1 = (60 - seconds) * 6 + 180 / mercury
  48. s2 = (60 - seconds) * 6 + 180 / venus
  49. s3 = (60 - seconds) * 6 + 180 'Earth and Moon
  50. s4 = (60 - seconds) * 6 + 180 / mars
  51. s5 = (60 - seconds) * 6 + 180 / jupiter
  52. s6 = (60 - seconds) * 6 + 180 / saturn
  53. s7 = (60 - seconds) * 6 + 180 / uranus
  54. s8 = (60 - seconds) * 6 + 180 / neptune
  55.  
  56.  
  57. 'Mercury
  58. oldx1 = x1
  59. x1 = INT(SIN(s1 / 45 * 3.141592) * angle / 4) + 400
  60. y1 = INT(COS(s1 / 45 * 3.141592) * (angle / 4) / tilt) + 300
  61.  
  62. 'Venus
  63. oldx2 = x2
  64. x2 = INT(SIN(s2 / 90 * 3.141592) * angle / 2) + 400
  65. y2 = INT(COS(s2 / 90 * 3.141592) * (angle / 2) / tilt) + 300
  66.  
  67. 'Earth
  68. oldx = x
  69. x = INT(SIN(s3 / 180 * 3.141592) * angle) + 400
  70. y = INT(COS(s3 / 180 * 3.141592) * angle / tilt) + 300
  71.  
  72. 'Mars
  73. oldx3 = x3
  74. x3 = INT(SIN(s4 / 270 * 3.141592) * angle * 1.5) + 400
  75. y3 = INT(COS(s4 / 270 * 3.141592) * (angle * 1.5) / tilt) + 300
  76.  
  77. 'Moon
  78. x4 = INT(SIN(19 * s3 / 270 * 3.141592) * angle / 10) + x
  79. y4 = INT(COS(19 * s3 / 270 * 3.141592) * (angle / 10) / tilt) + y
  80.  
  81. 'Outer Planets
  82. 'Jupiter
  83. oldx5 = x5
  84. x5 = INT(SIN(s5 / 450 * 3.141592) * angle * 3) + 400
  85. y5 = INT(COS(s5 / 450 * 3.141592) * (angle * 3) / tilt) + 300
  86.  
  87. 'Saturn
  88. oldx6 = x6
  89. x6 = INT(SIN(s6 / 630 * 3.141592) * angle * 4.5) + 400
  90. y6 = INT(COS(s6 / 630 * 3.141592) * (angle * 4.5) / tilt) + 300
  91.  
  92. 'Uranus
  93. oldx7 = x7
  94. x7 = INT(SIN(s7 / 810 * 3.141592) * angle * 6) + 400
  95. y7 = INT(COS(s7 / 810 * 3.141592) * (angle * 6) / tilt) + 300
  96.  
  97. 'Neptune
  98. oldx8 = x8
  99. x8 = INT(SIN(s8 / 990 * 3.141592) * angle * 7.5) + 400
  100. y8 = INT(COS(s8 / 990 * 3.141592) * (angle * 7.5) / tilt) + 300
  101.  
  102.  
  103. 'Sun
  104. CIRCLE (400, 300), 2, _RGB32(249, 240, 22)
  105. PAINT (400, 300), _RGB32(249, 240, 22)
  106.  
  107. IF tilt > 6 THEN
  108.     IF x1 > oldx1 THEN z(1) = 1
  109.     IF x2 > oldx2 THEN z(2) = 1
  110.     IF x3 > oldx3 THEN z(3) = 1
  111.     IF x5 > oldx5 THEN z(4) = 1
  112.     IF x6 > oldx6 THEN z(5) = 1
  113.     IF x7 > oldx7 THEN z(6) = 1
  114.     IF x8 > oldx8 THEN z(7) = 1
  115.     IF x > oldx THEN z(8) = 1
  116.     IF x1 < oldx1 THEN z(1) = 0
  117.     IF x2 < oldx2 THEN z(2) = 0
  118.     IF x3 < oldx3 THEN z(3) = 0
  119.     IF x5 < oldx5 THEN z(4) = 0
  120.     IF x6 < oldx6 THEN z(5) = 0
  121.     IF x7 < oldx7 THEN z(6) = 0
  122.     IF x8 < oldx8 THEN z(7) = 0
  123.     IF x < oldx THEN z(8) = 0
  124.  
  125.     IF z(1) = 0 THEN
  126.         'Mercury
  127.         CIRCLE (x1, y1), 5, _RGB32(120, 98, 102)
  128.         PAINT (x1, y1), _RGB32(120, 98, 102)
  129.     END IF
  130.  
  131.     IF z(2) = 0 THEN
  132.         'Venus
  133.         CIRCLE (x2, y2), 5, _RGB32(161, 67, 39)
  134.         PAINT (x2, y2), _RGB32(161, 67, 39)
  135.     END IF
  136.  
  137.     IF z(8) = 0 THEN
  138.         'Earth
  139.         CIRCLE (x, y), 5, _RGB32(0, 0, 255)
  140.         PAINT (x, y), _RGB32(0, 0, 255)
  141.         'Moon
  142.         CIRCLE (x4, y4), 2.5, _RGB32(179, 179, 181)
  143.         PAINT (x4, y4), _RGB32(179, 179, 181)
  144.     END IF
  145.     IF z(3) = 0 THEN
  146.         'Mars
  147.         CIRCLE (x3, y3), 5, _RGB32(240, 72, 22)
  148.         PAINT (x3, y3), _RGB32(240, 72, 22)
  149.     END IF
  150.     IF z(4) = 0 THEN
  151.         'Outer Planets
  152.         'Jupiter
  153.         CIRCLE (x5, y5), 5, _RGB32(255, 166, 127)
  154.         PAINT (x5, y5), _RGB32(255, 166, 127)
  155.     END IF
  156.     IF z(5) = 0 THEN
  157.         'Saturn
  158.         CIRCLE (x6, y6), 5, _RGB32(255, 127, 127)
  159.         PAINT (x6, y6), _RGB32(255, 127, 127)
  160.         FOR rings = 1 TO 2
  161.             CIRCLE (x6, y6), 7 + rings, _RGB32(255, 127, 127), , , .65
  162.         NEXT rings
  163.     END IF
  164.     IF z(6) = 0 THEN
  165.         'Uranus
  166.         CIRCLE (x7, y7), 5, _RGB32(127, 166, 255)
  167.         PAINT (x7, y7), _RGB32(127, 166, 255)
  168.     END IF
  169.     IF z(7) = 0 THEN
  170.         'Neptune
  171.         CIRCLE (x8, y8), 5, _RGB32(0, 78, 255)
  172.         PAINT (x8, y8), _RGB32(0, 78, 255)
  173.     END IF
  174.  
  175.  
  176.     'Mercury
  177.     CIRCLE (x1, y1), 5, _RGB32(120, 98, 102)
  178.     PAINT (x1, y1), _RGB32(120, 98, 102)
  179.  
  180.     'Venus
  181.     CIRCLE (x2, y2), 5, _RGB32(161, 67, 39)
  182.     PAINT (x2, y2), _RGB32(161, 67, 39)
  183.  
  184.     'Earth
  185.     CIRCLE (x, y), 5, _RGB32(0, 0, 255)
  186.     PAINT (x, y), _RGB32(0, 0, 255)
  187.     'Moon
  188.     CIRCLE (x4, y4), 2.5, _RGB32(179, 179, 181)
  189.     PAINT (x4, y4), _RGB32(179, 179, 181)
  190.  
  191.     'Mars
  192.     CIRCLE (x3, y3), 5, _RGB32(240, 72, 22)
  193.     PAINT (x3, y3), _RGB32(240, 72, 22)
  194.  
  195.     'Outer Planets
  196.     'Jupiter
  197.     CIRCLE (x5, y5), 5, _RGB32(255, 166, 127)
  198.     PAINT (x5, y5), _RGB32(255, 166, 127)
  199.  
  200.     'Saturn
  201.     CIRCLE (x6, y6), 5, _RGB32(255, 127, 127)
  202.     PAINT (x6, y6), _RGB32(255, 127, 127)
  203.     FOR rings = 1 TO 2
  204.         CIRCLE (x6, y6), 7 + rings, _RGB32(255, 127, 127), , , .65
  205.     NEXT rings
  206.  
  207.     'Uranus
  208.     CIRCLE (x7, y7), 5, _RGB32(127, 166, 255)
  209.     PAINT (x7, y7), _RGB32(127, 166, 255)
  210.  
  211.     'Neptune
  212.     CIRCLE (x8, y8), 5, _RGB32(0, 78, 255)
  213.     PAINT (x8, y8), _RGB32(0, 78, 255)
  214.  
  215. IF seconds > 99999 THEN
  216.     CLS
  217.     seconds = 0
  218.     GOTO one:
  219. GOTO one:
  220.  
  221.