Rotating a sprite around a central point while allowing it to move closer and further

0 favourites
  • 3 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • I'm planning a little experimental fighting game just to mess around. Two fighters will be locked into circular motion around each other. If this was all I was doing, I'd just rotate around the origin. However, I want the fighters to move between being close, medium, and far from the center.

    I could just create three sets for each sprite and have the sprites change when the characters change states, but that seems like a waste of sprites. Changing the origin at runtime doesn't seem like a "thing", so how would you go about this?

  • You can set the position of moving object like this :

    X = center.X + distance *cos( angle between 2 objects)

    Y = center.Y + distance *sin( angle between 2 objects)

    CENTER is your static object

    Then you increase or decrease to make it further or closer

    Change angle to make it rotate clockwise or counter clockwise.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Is you don't want to deal with formulas, maybe you could pin the object position to another one. While the first sprite can be rotating, the other one is setting the position only.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)