Trouble making multiple objects rotate

Get help using Construct 2

Post » Tue Apr 23, 2013 11:06 pm

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.
B
15
S
1
Posts: 12
Reputation: 1,565

Post » Wed Mar 30, 2016 5:39 am

I'm bumping this post-having the exact same problem
B
34
S
20
G
11
Posts: 9
Reputation: 8,426

Post » Wed Mar 30, 2016 6:29 pm

I made an example project for you which has 5 objects rotate a center object with each having individual velocity and distance.
Image

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

Here is a picture of the event sheet
Image

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
B
18
S
7
G
3
Posts: 28
Reputation: 2,413


Return to How do I....?

Who is online

Users browsing this forum: GUN and 17 guests