Have 8 squares surround 1 and rotate around it

Get help using Construct 2

Post » Wed Aug 21, 2013 8:44 am

So I have this scenario:

123
456
789

I want the outside tile to rotate around the center tile clockwise or counter-clockwise. So what I mean by clockwise is this:

412
753
896

I've tried for a solid hour and can't for the life of me figure it out.

There are four types of tiles. The all belong to a family. I tried with families and with individual tiles which gave me different but wrong results.

My basic method was to identify each tile by where it was with respect to a cursor (e.g. cursor.x, cursor.y+64). Based on where the tile was I would say it's private boolean variable is true. So for the example and going with counter-clockwise I would say GoingLeft is true. Then I would have another statement that said if GoingLeft is true move left 64 pixels and set GoingLeft to false. Not sure why that's not working.

Help would be great, thanks!
B
10
S
4
G
3
Posts: 103
Reputation: 2,984

Post » Wed Aug 21, 2013 9:12 am

You just set the starting angle of the blocks around the main one, than when it is moved forward X amount twice add 90 degrees to the blocks angle. Here is a complete example.

the key is the blocks instance variables and their starting angles.
https://www.dropbox.com/s/x6eqyat8p9f5rbi/Rotation%20Example.capx
Nvenom2013-08-21 09:13:32
B
6
S
1
G
1
Posts: 14
Reputation: 453

Post » Wed Aug 21, 2013 9:35 pm

[QUOTE=Nvenom] You just set the starting angle of the blocks around the main one, than when it is moved forward X amount twice add 90 degrees to the blocks angle. Here is a complete example.

the key is the blocks instance variables and their starting angles.
https://www.dropbox.com/s/x6eqyat8p9f5rbi/Rotation%20Example.capx
[/QUOTE] @Nvenom
Ah, thanks, nice solution. Problem is, I don't want the tiles to rotate (imagine the tiles are from a game like Pipe Dream). How would that change things?
B
10
S
4
G
3
Posts: 103
Reputation: 2,984

Post » Thu Aug 22, 2013 6:29 pm

I Searched for a while to figure out moving an object without angling it.. without a separate sprite beneath it that is handling the moving with just a Image layered above it pinned to it i cant seem to find a way. so i just went with changing the position.. as its much easier to do.

Added another instance variable to handle when to change the direction its position is moving, the events are pretty easy to follow :D

https://www.dropbox.com/s/x6eqyat8p9f5rbi/Rotation%20Example.capx
B
6
S
1
G
1
Posts: 14
Reputation: 453

Post » Fri Aug 23, 2013 12:08 am

@Nvenom
It works! Thanks buddy.
B
10
S
4
G
3
Posts: 103
Reputation: 2,984


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, JackTYGA, Kin, worm1 and 29 guests