How do I Test for objects below others

Get help using Construct 2

Post » Tue May 24, 2016 10:11 pm

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
B
3
S
1
Posts: 3
Reputation: 275

Post » Tue May 24, 2016 11:07 pm

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 .
What I know would fill a Book , what I don't know would fill a Library
B
37
S
12
G
29
Posts: 331
Reputation: 16,499

Post » Wed May 25, 2016 11:31 pm

thanks heaps!!! I never knew you could test for is overlapping at offset :)))
B
3
S
1
Posts: 3
Reputation: 275


Return to How do I....?

Who is online

Users browsing this forum: wizdigitech, Zamargo and 14 guests