NEED HELP: player crushed between blocks

Get help using Construct 2

Post » Tue Dec 16, 2014 9:12 pm

guys please help:

how do i use collision detection to kill the player if he gets trapped between two blocks...and only if trapped between them.

in another works, if player is jumping and a block hits him from the top, the block wont kill him but move him down, if the player doesnt get out of the way and eventually there's no where to go (ie., the player has gotten trapped between the falling block and the one stationary block underneath him), then and only then he dies.

please help, i am making a platform game with falling bolders and want to get this to work but it doesnt
You do not have the required permissions to view the files attached to this post.
B
131
S
40
G
10
Posts: 131
Reputation: 13,445

Post » Tue Dec 16, 2014 9:16 pm

Check the distance between the blocks is less than the player height (between the bottom edge of the top block and top edge of the bottom block. Could use 'is overlapping at offset' or something). Just one of a bazillion ways :)
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Tue Dec 16, 2014 9:21 pm

can you pleaseeeeee give a capx example, if its not too much trouble...not sure how to check for offsets between to two blocks and the player
B
131
S
40
G
10
Posts: 131
Reputation: 13,445

Post » Tue Dec 16, 2014 11:37 pm

Like codah said there are many different ways and they really depend on the type of game. One way would be to use some sprites as detectors.

Attached is a way to make thwomps like in mario.
You do not have the required permissions to view the files attached to this post.
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959

Post » Tue Dec 16, 2014 11:50 pm

great thanks...that's exactly what i needed. only one last question: why add the "control" object and the "sprite 2" and then pin them to each other. why not just have the "sprite 2"?

thanks again for your help, the capx was what i needed...only cannot understand the need for the 2 objects and pinning them to each other
B
131
S
40
G
10
Posts: 131
Reputation: 13,445

Post » Wed Dec 17, 2014 4:23 am

It's a simple enough capx, change it to one object and see what happens.

The control object acts as a shield so you can run up against the sides of the crushers with out dying. As one object It's just: if player overlaps crusher then die.
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959


Return to How do I....?

Who is online

Users browsing this forum: ChoosyZerk, Google [Bot] and 57 guests

cron