How do I rotate a group of object like tetris but with 4 individual blocks.

0 favourites
  • 3 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • I am trying to create a tetris type game. The example has all of the shapes drawn in an animation frame. Then you can rotate it the frame except for frame three since it is already a box. I would like to be able to use the same principle but have each block be individual, with individual collision behavior, gravity ect.

    For example I would like the L shaped tetris piece be four individual sprite objects, be able to rotate it just like the L shaped piece in tetris. When the L shaped tetris piece collides with other object break up and no longer be apart of that L tetris piece.

    Any suggestions on how to do this. I got most of it figure out except the rotation.

  • Here’s a few ideas.

    The first is to to make the L shape out of a single object so it’s easy to move and rotate. Then when it lands you create the smaller squares on top of the shape, and then destroy the shape. You could utilize image points to mark where to create the smaller sprites.

    Another idea is to have another hidden object to act as the rotation center and use the pin behavior to attach the squares. Delays of when the behavior runs may or may not be an issue.

    A third idea is a more manual method. First you create the squares in the shape you want, and probably use an instance variable to help with picking just them and then rotate them with this equation:

    Set position to (self.x-centerx)*cos(90)-(self.y-centery)*sin(90)+centerx, (self.x-centerx)*sin(90)+(self.y-centery)*cos(90)+centery

    Where centerx, centery is the position to rotate around and 90 is how much to rotate.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the reply

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