Here is a much nicer version. The planets stay appeared until right before they go behind the Sun. I also made Saturn look better. I was able to do this by adding some more info on the IF/THEN statements to see where the coordinates are exactly. I added this to the ones that see if the planets are going right or left so I know where they are headed. Check this one out. :) Also, I didn't mean to hijack your thread here. I would make my own thread but I already have this in 1 other thread as well lol.
Oh, and don't ask about the Moon orbit. I tried hiding that behind the Earth and couldn't do it. It's just barely noticeable anyway. :)
'Ken G. made thie program on August 18, 2019,
'Thank you to STxAxTIC on the QB64.org forum for a little bit of help with The Moon orbit!
_TITLE "Solar System Simulator by Ken G. Use Mouse Over Planets, Mouse Wheel to Zoom, and Up and Down Arrow Keys To Tilt." mercury = 0.241
venus = 0.6152
mars = 1.8809
jupiter = 11.8618
saturn = 29.457
uranus = 84.0205
neptune = 164.8
angle = 180
tilt = 1
one:
mouseWheel = 0
IF mouseWheel
< 0 THEN angle
= angle
- 10 IF mouseWheel
> 0 THEN angle
= angle
+ 10
IF angle
> 360 THEN angle
= 360 seconds = seconds + .01
s1 = (60 - seconds) * 6 + 180 / mercury
s2 = (60 - seconds) * 6 + 180 / venus
s3 = (60 - seconds) * 6 + 180 'Earth and Moon
s4 = (60 - seconds) * 6 + 180 / mars
s5 = (60 - seconds) * 6 + 180 / jupiter
s6 = (60 - seconds) * 6 + 180 / saturn
s7 = (60 - seconds) * 6 + 180 / uranus
s8 = (60 - seconds) * 6 + 180 / neptune
'Mercury
oldx1 = x1
x1
= INT(SIN(s1
/ 45 * 3.141592) * angle
/ 4) + 400y1
= INT(COS(s1
/ 45 * 3.141592) * (angle
/ 4) / tilt
) + 300
'Venus
oldx2 = x2
x2
= INT(SIN(s2
/ 90 * 3.141592) * angle
/ 2) + 400y2
= INT(COS(s2
/ 90 * 3.141592) * (angle
/ 2) / tilt
) + 300
'Earth
oldx = x
x
= INT(SIN(s3
/ 180 * 3.141592) * angle
) + 400y
= INT(COS(s3
/ 180 * 3.141592) * angle
/ tilt
) + 300
'Mars
oldx3 = x3
x3
= INT(SIN(s4
/ 270 * 3.141592) * angle
* 1.5) + 400y3
= INT(COS(s4
/ 270 * 3.141592) * (angle
* 1.5) / tilt
) + 300
'Moon
x4
= INT(SIN(19 * s3
/ 270 * 3.141592) * angle
/ 10) + x
y4
= INT(COS(19 * s3
/ 270 * 3.141592) * (angle
/ 10) / tilt
) + y
'Outer Planets
'Jupiter
oldx5 = x5
x5
= INT(SIN(s5
/ 450 * 3.141592) * angle
* 3) + 400y5
= INT(COS(s5
/ 450 * 3.141592) * (angle
* 3) / tilt
) + 300
'Saturn
oldx6 = x6
x6
= INT(SIN(s6
/ 630 * 3.141592) * angle
* 4.5) + 400y6
= INT(COS(s6
/ 630 * 3.141592) * (angle
* 4.5) / tilt
) + 300
'Uranus
oldx7 = x7
x7
= INT(SIN(s7
/ 810 * 3.141592) * angle
* 6) + 400y7
= INT(COS(s7
/ 810 * 3.141592) * (angle
* 6) / tilt
) + 300
'Neptune
oldx8 = x8
x8
= INT(SIN(s8
/ 990 * 3.141592) * angle
* 7.5) + 400y8
= INT(COS(s8
/ 990 * 3.141592) * (angle
* 7.5) / tilt
) + 300
'Sun
'Mercury
'Venus
'Earth
'Moon
'Mars
'Outer Planets
'Jupiter
'Saturn
'Uranus
'Neptune
'Mercury
'Venus
'Earth
'Moon
'Mars
'Outer Planets
'Jupiter
'Saturn
'Uranus
'Neptune
seconds = 0
Hi Ken,
Not hijacking if working towards goal of presenting Solar System in 3D, I had same thought!
Nope, what I am deeply, deeply saddened by is that you aren't using the handy dandy FillCircle routine I worked up for you, you could cut your program lines in half (almost):
FOR changeRadius
= .25 TO circleRadius
STEP .25 CIRCLE (centerX
, centerY
), changeRadius
, circleColor
Maybe I should have named it SUB KensCircleFill(x, y, r, Kolor as _unsigned long)
...wait is that the problem? Kolor as _UNSIGNED LONG ?
That's THE TYPE to use for Color variables in a graphics screen, it allows _RGB32() colors and &HAARRGGBB (< fix thanks Steve) colors and once you get to using alpha = transparencies you will never look back! :))
You use the SUB just like you use CIRCLE, only you don't put x, y in (),
KensFillCircle x, y, r, _RGB32(255, 0, 0)
BTW, never change anything inside the SUB, change the variables used in the call to the SUB
KensFillCircle x, y, r, Colr '< change any variable or number here in main code.
another example of a "call" to use the sub
'drawMars
KensFillCircle marsX, marsY, marsRadius, _RGB32(255, 0, 0) ' < Mars color
and you could really, really cut your program lines down by using a planetary array or arrays, so I don't have to read mindless repetition of code, but we can only change things one step at a time... :)