How do you make crushers? or a crushing behavior?

applepi92

  • Posts: 17
So i'm making a game where i'd like pistons or actors to come down from the top of the screen to crush the player if they are under it.

frankly i have no idea where to start with this. I thought i could cheat and make a rectangular actor and apply a vertical platform movement to it, and just put some code on the player that would say it would die if it got hit on its head, but this doesn't work.  it simply freezes the flash tester so i have to force quit it.

I feel like i'm just being stupid and not thinking about this right, but does anyone know how to do this?

Play

  • Posts: 165
I'd do as you said and give the the crusher typical vertical platform movement. If you only want it to move down when the player is under it, have it only move when x of the player = x of the crusher. Then to kill the player, check if the top was hit specifically by the crusher and the bottom was hit by anything. This will only kill the actor if it is squished. Otherwise, the player will die if it simply jumps up and touches the crusher (which you may actually want).

Edit: Also, you don't need to say if <<the top was hit> = true>, instead just put if the top was hit.

« Last Edit: April 05, 2012, 04:53:50 pm by Play »

applepi92

  • Posts: 17
okay i made the changes to the script, but i'm still having the problem that every time my player goes under the crusher and it hits them, the flash debugger freezes and stops working.  do you think it would just be better to scrap work on this game, i've not almost nothing so far, and start working a new game file.  or is there something else going on here?

rob1221

  • *
  • Posts: 9473
Crushing any actors with full physics enabled will crash the game most of the time.  I'm not really sure how to solve the problem though.  Sensors might avoid the crash, but from what I've read you can't use "if top was hit" with a sensor collision shape.  Maybe you can make a separate collision shape just for the bottom of the crushing actor and if that collides with a separate sensor collision shape on the player, kill the player.

applepi92

  • Posts: 17
um i'm really bad with collision shapes, so i have no idea how i would do this.  but i know that you can do this cause i see it in this game:  http://www.stencyl.com/game/play/8451

sparttenomega

  • Posts: 39
Im just taking a guess here,but maybe you could just fake it crushing the player by restarting the scene once the thing hits the top of the player.I believe that's what may be happening in the game you said had crusher type things.

applepi92

  • Posts: 17
I tried that and i'm running into the say problem

applepi92

  • Posts: 17
okay i got it to work with Aasimar's behavior that they posted

scradsleep

  • Posts: 12
<Bump> i am making a crusher also , i want it to pause when it gets to the top for 1.5 seconds and then come back down to crush is anyone able to help with this