'Crushing' an actor

JeffreyDriver

  • Posts: 2262
I've been playing around, trying to get this working, but have been running into difficulty.

I'm trying to detect when an actor is being crushed (i.e being touched by tiles at the top and bottom of the actor simultaneously.)

However, my efforts have resulted in the actor either not being killed at all, or killed when just the top hits a tile. Any help gratefully appreciated.

I've attached screenshots of the code. One of the full code, and one just showing any code that's relevant.

EDIT: I've been trying to solve it by checking if the player is airborne or not. My reasoning was that if the player isn't airborne, and the top of the player hits a tile, the player must be getting crushed.  But this approach hasn't worked.

« Last Edit: July 26, 2016, 05:05:37 am by JeffreyDriver »

noxtudios

  • Posts: 293
Did you get this resolved..?
Im assuming that the player actor is exactly the same collision box height of a tile?, if it is slightly smaller, then i will not touch the top and bottom of a tile exactly.

May I ask how you are making the player get crushed in between tiles? do the tiles collision box slope? so the gap gets smaller?

I would put in some debug messages in some of the Collision events to make sure they are triggering..

JeffreyDriver

  • Posts: 2262
Did you get this resolved..?
Im assuming that the player actor is exactly the same collision box height of a tile?, if it is slightly smaller, then i will not touch the top and bottom of a tile exactly.

May I ask how you are making the player get crushed in between tiles? do the tiles collision box slope? so the gap gets smaller?

I would put in some debug messages in some of the Collision events to make sure they are triggering..

I've got closer, but it's not perfect. The actor is a bit smaller than two tiles. The only way the player should get crushed is if they get caught between a moving platform and a tile. At the moment, the player is getting crushed if they jump and hit a platform or tile above them too quickly. It shouldn't really come up much in the game, but I may have to move a few things around on some levels.

noxtudios

  • Posts: 293
Ahh, where is the collision code with the moving platforms? I can only see the tiles? Or did you put the moving tile actors into the tile group?

JeffreyDriver

  • Posts: 2262
Initially I did have a separate group for the platforms, but I changed it to just tiles as the effect was the same.