Rotating 4 seperate elements clockwise with one referance

Hi, I know i need to search the documention first for such thing but i am new new to coding, i did C++ but i still have to get use to Lua. the task is to rotate a square clock or anti clock based on were its tapped with respect to its center, right or left respectively ,Simple. now the square is made of 4 different elements (.Png file) say different thickness (10.png,20.png,30.png & 40.png), each of this side react differently to different element. Say 10.png side collide with small object but breaks for the larger object. The issue is every time i tap the square just doesnt rotate properly. Were do i find good sample code. Again this will be a big help if i can understand how to do it.

Hi @shaqqs,

This may be better explained visually so that others and staff can help you. Can you post a screenshot (or multiple) showing what you want to accomplish, how these objects would be positioned, and what would happen when the user taps (and where)?

To post screenshots, click the “More Reply Options” below the response text box in the forums, then on the following page you’ll see a little option box below it to attach images.

Thanks,

Brent

thanks for the reply, as shown in the screen shot the circle is made of 4 different colour piece (pie) and each react different to the surrounding element, and want then to rotate 90 degree in the respective direction of the tap with respect to the center of the circle.

Hi @shaqqs,

So basically, the entire circle/clock should rotate as one unified element? Or will some colors need to rotate independently of others?

Brent

Exactly i want the circle to rotate as one part, i can split the circle in more color pie piece and they will, but each part pie piece is different .JPG art work.

Hi @shaqqs,

OK, in this case, I suggest that you insert the different pieces into a display group, and then you rotate the entire display group as a single entity. Later, if you need to manipulate just one piece (wedge) of the circle individually, make sure that you define some kind of reference to each piece so that you can access it (by some defined name, ID, or similar).

I also suggest that you use non-center anchor points on the individual pieces. Specifically, anchor the pieces at their “point” that resides in the center of the overall circle. That way, if you want to rotate just one piece, it will rotate around that point, not around its own center.

Here are some guides to get you started:

http://docs.coronalabs.com/guide/graphics/group.html

http://docs.coronalabs.com/guide/graphics/transform-anchor.html

Best regards,

Brent

Hi @shaqqs,

This may be better explained visually so that others and staff can help you. Can you post a screenshot (or multiple) showing what you want to accomplish, how these objects would be positioned, and what would happen when the user taps (and where)?

To post screenshots, click the “More Reply Options” below the response text box in the forums, then on the following page you’ll see a little option box below it to attach images.

Thanks,

Brent

thanks for the reply, as shown in the screen shot the circle is made of 4 different colour piece (pie) and each react different to the surrounding element, and want then to rotate 90 degree in the respective direction of the tap with respect to the center of the circle.

Hi @shaqqs,

So basically, the entire circle/clock should rotate as one unified element? Or will some colors need to rotate independently of others?

Brent

Exactly i want the circle to rotate as one part, i can split the circle in more color pie piece and they will, but each part pie piece is different .JPG art work.

Hi @shaqqs,

OK, in this case, I suggest that you insert the different pieces into a display group, and then you rotate the entire display group as a single entity. Later, if you need to manipulate just one piece (wedge) of the circle individually, make sure that you define some kind of reference to each piece so that you can access it (by some defined name, ID, or similar).

I also suggest that you use non-center anchor points on the individual pieces. Specifically, anchor the pieces at their “point” that resides in the center of the overall circle. That way, if you want to rotate just one piece, it will rotate around that point, not around its own center.

Here are some guides to get you started:

http://docs.coronalabs.com/guide/graphics/group.html

http://docs.coronalabs.com/guide/graphics/transform-anchor.html

Best regards,

Brent