Pressure pad (Toggle Trigger)

Get help using Construct 2

Post » Mon Jun 02, 2014 12:42 pm

I am trying to create a pressure pad that will open a door when the player walks over it and closes the door when he walks off it.

this is my setup

Code: Select all
PLAYER on collision with PRESSUREPAD = set ACTIVE(Instance Variable) to 1
ACTIVE = 0 = Door Open
ACTIVE = 1 = Door Closed


So I cant figure out how to know when the player has finished the colliding with the object so it can set the instance variable back to 0?
B
6
S
3
Posts: 39
Reputation: 632

Post » Mon Jun 02, 2014 2:17 pm

Use Else.

If player on collision with pressure pad set ACTIVE = 1

Else Set ACTIVE = 0

Or use

If player on collision with pressure pad set ACTIVE = 1
X If player on collision with pressure pad set ACTIVE =0

or

Evert Tick set ACTIVE = 0
If player overlapping with pressure pad set ACTIVE = 1

This might be better for a pressure pad as it sets ACTIVE to 1 only whilst the player is in contact with it
B
47
S
16
G
9
Posts: 1,097
Reputation: 11,180

Post » Mon Jun 02, 2014 9:26 pm

Thanks for the reply,

I did try else but it said it couldnt be used there (not sure exaxtly what the problem was, ill retry after work)

Also wouldnt using tick be bad for peformance and generaly a bad practixe?
as it would just be constantly setting it to zero when its a tiny feature of a large map
B
6
S
3
Posts: 39
Reputation: 632

Post » Mon Jun 02, 2014 9:28 pm

No effect on performance using every tick at all.
B
47
S
16
G
9
Posts: 1,097
Reputation: 11,180

Post » Wed Jun 04, 2014 5:44 am

Unfortunately I still cannot get it to deactivate, heres two event sheets i tried out.

Image
B
6
S
3
Posts: 39
Reputation: 632

Post » Wed Jun 04, 2014 7:53 am

Try this example..

In your code you are setting IO to off every tick when IO =0 which it never is.
You do not have the required permissions to view the files attached to this post.
B
47
S
16
G
9
Posts: 1,097
Reputation: 11,180

Post » Wed Jun 04, 2014 9:40 am

Had to download r170 to check out the example, but i understand it now, thanks for the help!
B
6
S
3
Posts: 39
Reputation: 632


Return to How do I....?

Who is online

Users browsing this forum: Exabot [Bot] and 17 guests