Pressure Plate Problems

0 favourites
  • 4 posts
  • Hello,

    I'm working on implementing pressure plates that can open doors when the player, a pushable box, or enemies stand on it. Then if they go off of the pressure plate the door slams shut. The events below are how I am doing that.

    For the box (events 30 and 31) it works as intended. However when I try to use the same events with the enemies I run into problems. The pressure plate goes down and the door opens but when the enemy walks off the pressure plate does not pop back up and the door remains open. I tried adding "For Each" events to specify the enemy, but the results are the same. I guess I must be missing something.

    Thanks,

    Snalec.

  • First of all, don't use "Trigger once" when multiple instances are involved, this is a common mistake which always causes problems.

    If you have multiple pressure plates and doors on the level, you need to use "For each plate" as the top condition. Also, you need to add a "state" variable to the plate. Here is how I would do this:

    For each Plate
    
     Enemies overlapping Plate
     or Box overlapping Plate 
     	Plate state="up"
    		: Plate set state "down"
    		: Plate move to (down)
    
     Else 
    	Plate state="down"
    		: Plate set state "up"
    		: Plate move to (up)
    
    
    

    You can also add all objects that can step on the pressure plate into a family, this will make things even easier.

  • Hello. Sorry I didn't see this right off. I figured it out and forgot to check back. Thank you for your response!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello. Sorry I didn't see this right off. I figured it out and forgot to check back. Thank you for your response!

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