Rotate around a center point while that center point is moving
Player_E
Member, PRO Posts: 604
Okay here is my current issue.
I have 5 actors in the current placement (crudely graphed below)
B
E A C
D
actor "A" is the center and actors "B,C,D,E" are placed around it like shown above.
Now I am trying to get actors "B,C,D,E" to rotate around the actor A while Actor "A" is floating around the screen bouncing off the walls. I want "B,C,D,E" to keep the same distance between each other that way it will look nice and clean.
Anyone have an Idea of the best way to achieve this?
I have 5 actors in the current placement (crudely graphed below)
B
E A C
D
actor "A" is the center and actors "B,C,D,E" are placed around it like shown above.
Now I am trying to get actors "B,C,D,E" to rotate around the actor A while Actor "A" is floating around the screen bouncing off the walls. I want "B,C,D,E" to keep the same distance between each other that way it will look nice and clean.
Anyone have an Idea of the best way to achieve this?
Comments
picture the graph like this +
unfortunately you can't change the pivot point in gamesalad, actors always rotates around the center of the png. So an idea is to make a big invisible PNG and then place BCDE in the right distance to the center of that PNG. Then constrain that PNG to you actor A and make it rotate. If you want BCDE to have different distances, you will have to make a PNG for each and every one of them. Then you could also give them different rotate speeds, which I think would look nice.
Hope that makes sense.
http://www.nsbasic.com/palm/info/technotes/TN25a.htm
It's basically
X = OriginX + cos(degree) * radius
Y = OriginY + sin(degree) * radius
So, set the degrees for each of B, C, D, E to 0, 90, 180, 270, respectively, and increase it.
I am using : How do I make an actor move in a perfect circle?
with the following rules;
Constrain attribute
self.Position.X to 65*cos( self.Time *200%360)+ game.Center X
Constrain attribute
self.Position.Y to 65*sin( self.Time *200%360)+ game.Center Y
This is working perfectly, but when I apply this rule to all 4 actors they all seem to start out at the 0 degree and rotate together so it looks like 1 actor.
Any thoughts on how to make them start at 0 Degree, 90 degree, 180 degree, and 270 degree?
http://gamesalad.com/game/play/61005
I have a few demos that do this as well...although mostly with one actor about the other. Would just have to add three more with the appropriate degree offset added to them.
your method was helpful, but the actors them self rotated even when I took off the rotate rule that you have in place. Since I have a drop shadow on my actor it did not look right, so I kind of fused your method and my method together and got it working nicely and my drop shadow stays in the same place. here is what I did incase anyone wants to try it out
Actor 1
constrain attribute
Self position X to game.Center X +65*cos( self.Time *200%360)
Self position Y to game.Center Y +65*sin( self.Time *200%360)
Actor 2
constrain attribute
Self position X to game.Center X +65*cos( self.Time *200%360+90)
Self position Y to game.Center Y +65*sin( self.Time *200%360+90)
Actor 3
constrain attribute
Self position X to game.Center X +65*cos( self.Time *200%360+180)
Self position Y to game.Center Y +65*sin( self.Time *200%360+180)
Actor 4
constrain attribute
Self position X to game.Center X +65*cos( self.Time *200%360+270)
Self position Y to game.Center Y +65*sin( self.Time *200%360+270)