Implementing Circular Gravity


Hi All

So i released this video online and received a question from youtuber anic99a asking how i achieved this cool effect. Let me begin to elaborate the demo was produced using game maker studio for rapid prototyping i’m still deciding if i should finish it up and release it as some kind of game.

The basics of the algorithm are not complected at all while the effect is very intriguing i have a player object and a planet object each planet has a mass value which determines the size and gravity pull.

In the players Step Event (Per Frame)
we loop through all the planets and apply force based on the players distance and angle to that planet


Firstly we get the distance between the player and the planet, then we get the direction of the player relative to the planet in question.

If the distance is less than 250 (arbitrary number) then we set dx and dy (direction x, direction y) 150 pixels away from the player in the direction of the planet.

Finally we apply physics to the player in that direction. I’m cheating using Box2D to handle collisions between the player and the planet but you can implement this into any engine.

The code is a bit messy and not optimized at all but for a quick 15 minute demo it works well. You can optimize this by making a generic script to be applied to any objects to handle planet gravity.


The core values of Indieverse

Hello everyone!

I am in the process of developing “Indieverse”.
Although having already posted to explain what “Indieverse” is, I’ve yet to explain our core values!

There seems to be a problem in the indie market right now.
Games are rated by their popularity and notoriety.

While this is all good, these games have all made the transition from indie into commercial games backed by publishers and ported by third party engineers to other platforms.

While this is great for some developers it’s not for the majority of us.
Indieverse is an effort to be an even playing field.

Your games and assets are not organized by initial popularity, but by a complicated algorithm that utilises overall exposure to the community and ratings from the indie community.

This way everyone should receive an equal amount of exposure.
If your content is good and people enjoy it you will receive positive ratings which will keep your content being rotated fairly around the site.

I want to keep the spirit of indie development alive.
As such I’m putting all my efforts into making the fairest, easiest to use, open to everyone, non exclusive platform,
for your hard work to be distributed through.

Indieverse, lets keep indie indie!