GameMaker: Orbiting


Looks of it. Also you can drag "planets" around.

Yesterday I've made an example for making instance orbit around other instance.
In contrast to other similar examples, here speed defined in a normal way (not angular), instance will detect distance to 'target' object automatically, and speed vector is stored in hspeed/vspeed, allowing to detect direction and impact speed easily.
Also code is well-commented, since several parts indeed require some knowledge to understand.

Download GMK

Related posts:

3 thoughts on “GameMaker: Orbiting

    • In simplest case you would modify step event code to set next angle to be 270 + sin(t) * c (where “t” is changed over time and “c” is swing arc). For actual pendulum physics you would need to incorporate some extra code to handle velocity and acceleration while still modifying that “next angle” variable in the end. I believe that GameMaker Community forums did contain at least a couple of such examples.

  1. the problem is that in the GMC forums they all work by modifing de x y variables directly, instead of using hspeed and vspeed.
    And what do you mean by “swing arc”? is it the angle in that moment?

Leave a Reply

Your email address will not be published. Required fields are marked *