0 Favourites

How do I Test for objects below others

  • I am currently in the process of making a game which involves a whole bunch of mini games, one of which is somewhat similar to Tetris. I have already designed a way for the blocks to spawn randomly, move down the screen, move left and right, and rotate. However, I have so far been unable to find a way to detect whether the blocks have collided with each other, and when they should stop moving. For the movement of the blocks I have used an event that tells the block to every X seconds move down 40 pixels (I am using a grid based system for the Tetris section and each square on the grid is 40px, 40px), and the same when left and right are pressed (move left 40 pixels, move right 40 pixels). I am also using families to spawn the blocks, as each of the different pieces are actually made of 3 or 4 separate sprites that are in a family and move in unison. It would be greatly appreciated if anyone knew of a way to detect when the blocks are touching each other so that we know when they should stop moving downwards

    Cheers, Kukukoke

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • [quote:1eukydda]Is overlapping another object

    Is overlapping at offset

    True if any instance is overlapping any instance of another object. The collision polygons are taken in to account if set, as well as the object's size and rotation. The 'offset' variant will test for an overlap at an offset from the first object. For example, testing for an overlap at an offset of (100, 0) will temporarily move the object to the right 100 pixels, test for the overlap, then move it back again.

    On collision with another object

    Triggered upon the first time any instance starts overlapping any instance of another object. The collision polygons are taken in to account if set, as well as the object's size and rotation.

    This should help you out .

  • thanks heaps!!! I never knew you could test for is overlapping at offset ))

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