Hey all, some exciting new updates!
First thing I did was implement JR’s compression of the code. It works perfectly and just a lot neater than the way I did it. I added a whole bunch of notes to try to compensate. It should be just barely comprehensible to the layman.
Next, I really wanted to fix two issues: The camera flipping and velocity magically changing directions when you change orbiting centers. This was not easy, but eventually I managed to make a fine-tuned system that takes the current velocity, divides it into a decmial-sized addition, and adds it to a new variable. This variable in essence stores all the previous velocities and adds them all together. This is then added to the current velocities (not the calculations, the actual X and Y velocities) to create a system that takes the entire system developed before and just adds another velocity factor to it. I also capped the stored velocity at 6, but this is arbitrary and just tailored for my example. It will greatly depend on what situation this system is used in for how strong the previous velocity should be. Because you get launched from previous velocities into the new orbit, the physics and more noticably the camera more smoothly transitions between two orbitals. It still isn’t perfect, but more on that later.
It seems like the orientation of the player is in relation to the top left, not the center, of the gravitational orbit block. I desire to fix this but am unaware of a solution that will work for all distances. Maybe this could lead me into creating a way to let the character roll and spin while still having accurate movement?
Finally, because the entire system is now gravity-dependent on most fronts, this allowed me to link player controls to gravity. You can no longer move or rotate when in space, but previous velocities still apply. This was a little janky to create, especially with the bundle output bug plaguing my existence, but it eventually ended up just swell.
There are numerous things which require further development, and I would greatly appreciate any comrades to brainstorm these with.
-Both the character and camera rotation still snap in place, which is especially evident on the larger planet in the example. I tried figuring out how to ease the change but to no avail.
-There are still instances in which jumping does not grant enough speed to transition the camera quickly to the other side, causing camera freakouts. However, the jump nearly always puts you to the correct planet now. Thus, I am thinking this is not something to fix, but rather to cover up, as the exact math is performing as accurate as can be without taking into account multiple gravitational pulls.
-I want to create a clone of this project once the development is finished in order to make easily accessible numbers. Rather than go through all the code meticulously, there could be a line of numbers with notes that clearly explain what changing each does (e.x. movement speed, carried velocity cap, gravitational strength) for extreme ease of use. No longer shall flowlabians be bound to two-dimensional gravity!
-Finally, I strongly desire, once all of the above is complete, to create another duplicate that is made to be extremely immersive and realistic. Planetary mass, distance, propulsion strength, mass of the player, and even potentially air resistance will all be accounted for. This will hopefully lead me into developing a micro-planetary exploration game where you take into account all the factors of movement before launching rockets to explore the stars. I am fostering a growing passion for space and this could be my perfect in on a unique game that the flowlab community has not seen the likes of ever before.
As always, thank you all for the support, critiques, and suggestions, and I look forward to the development process!