Use your cursor to attract the ball in the direction you want. I was going to make this a game, but ideas aren't really coming at me-- suggestions are nice! Currently working on a little more here-- thanks to @Nintendus for the following ideas: - Rocket ship (Finished) - Planets (Not implemented yet)
I made this because of the "Zero Gravity" SDS. This is basically my attempt at making a very tiny space-physics engine, though it's not very good (instead of a circular or elliptical orbit, you get a banana-shaped one sometimes). Below is my explanation on how this works. For any of those who know gravitational physics, please tell me how I can make this better!!! How this works: F = Gm₁m₂r⁻², and because F = ma, a ∝ kr⁻². In this context, k is some random constant that I decided to later set to 20, r is the distance between the center of the ball and the point of the cursor, and a is the acceleration. In brief, I wrote a script that would take the acceleration of the ball, and, being that acceleration is a 2D vector, I broke it into two component vectors (as seen in the variables). Then, I have two velocity component vectors (again, basically variables representing horizontal and vertical direction), and I change them by the corresponding acceleration. Then I change the x and y positions by the velocity.