Have 8 squares surround 1 and rotate around it

  • 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!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

    dropbox.com/s/x6eqyat8p9f5rbi/Rotation%20Example.capx

  • 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

    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?

  • 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

    dropbox.com/s/x6eqyat8p9f5rbi/Rotation%20Example.capx

  • Nvenom

    It works! Thanks buddy.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)