Group and Manipulate

Get help using Construct 2

Post » Thu Nov 29, 2012 3:18 pm

Is it possible to group a collection of sprites and have them rotate arround the center of the combined group? Best I can get so far is to have each individual sprite roate on its own axsis haha.
B
39
S
12
G
8
Posts: 580
Reputation: 7,108

Post » Thu Nov 29, 2012 3:23 pm

In the editor? Nope unfortunately.
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Thu Nov 29, 2012 3:31 pm

I actually mean in-game, which makes me think it must be obvious.

But yes also in the editor would be useful.
B
39
S
12
G
8
Posts: 580
Reputation: 7,108

Post » Thu Nov 29, 2012 3:40 pm

A trial-and-error fix you can try is moving them all 1 pixel ahead and rotate them 1 degree every tick, then raise those values until you get the effect you want.

Otherwise this page explains the math a bit for rotating a point: http://www.siggraph.org/education/materials/HyperGraph/modeling/mod_tran/2drota.htm (uses radians, so you'll need to multiply by 180/pi). It'll take a lot of tweaking though I think

Instead of moving objects to the "origin", you can run loops to add up the number of objects to a variable, the sum of their X positions to a variable, and the sum of their Y positions to a variable. Then calculate the center point between them as XSum/NumObjs and YSum/NumObjs.

Edit: Ah actually there's an even easier way to do that! Have a layer separate for the objects you want to rotate and then move them into it and change the layer angle instead

It's only a visual effect this way it seems, as objects go right back to where they were on other layers: https://dl.dropbox.com/u/4714446/LayerRotate.capxJayjay2012-11-29 15:56:53
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests