0 Favourites

Trouble making multiple objects rotate

  • I've been trying to make multiple objects rotate around another object. In the game I'm designing, the player is in the middle and enemies randomly spawn off screen and hover toward the player.

    I've tried following this tutorial (http://www.scirra.com/forum/how-do-i-make-earth-rotate-around-the-sun_topic45633.html) but I'm having trouble getting it to work with multiple objects. With a single object the example works perfectly, but it runs into some issues when you add more objects. For example, if you add 3 more circles in the example then they will all overlap and it appears there is only one circle.

    I've tried adding "For Each" into the condition, which allows there you to see multiple objects, but it aligns all the objects in a single line according to their distance. I've tried storing their distance values in an instance variable, so that each object would have it's own unique value, but you cannot use instance variables when setting the position. I've been wracking my brain over this for a while, but I just can't think of a way to have multiple objects slowly circle a single object.

  • I'm bumping this post-having the exact same problem

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I made an example project for you which has 5 objects rotate a center object with each having individual velocity and distance.

    Here is the project file http://bit.ly/1MBPwlI

    Here is a picture of the event sheet

    Rotator has 3 instance variables which get randomized at the start: distance to center, degree/angle from center, and velocity which ranges from -1 to 1

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