Button loop

Get help using Construct 3!

Post » Fri Jun 23, 2017 1:35 am

Message: OscarC can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Here is what I have. It works but only once.
Basically, I have a button. When I press the button a door opens. When I press it again it closes. If I press it again, it should open again...etc. ad infinitum
I got it to open once, close once, then that's it.

The door is just a tiled object and when I press the button the first time, it brings it forward on the layer and when I click it again it puts it to the bottom.

I know I need some kind of loop but not sure how to do this.
If I could use BASIC like commands in the even sheet, I would do a "GOTO 1" after the last line :geek:
Here is what I have as an event to the button.

http://imgur.com/a/VroYW

Maybe I need to be using sprites or something for this.

Thanks for helping this old n00b out :D
B
3
S
1
Posts: 2
Reputation: 279

Post » Fri Jun 23, 2017 9:12 am

It's rather inefficient using wait for signal with wait n seconds. In your case, just remove signal action and make second event identical with previous event with 'doorstate' set differently. Your current event sheet just make it works once because the variable 'doorstate' wasn't reset to initial value. That's the problem

Switching between state can be easily done by utilizing toggle boolean.
ImageImage
B
108
S
49
G
23
Posts: 783
Reputation: 22,611

Post » Fri Jun 23, 2017 12:01 pm

https://www.dropbox.com/s/t5mv8o10zh4l3 ... .capx?dl=0

Use the same trigger only once, and 'else' is essential.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Jun 23, 2017 5:16 pm

@OscarC play my recent game and have a look at the door here https://www.scirra.com/arcade/puzzle-ga ... ic-19003is in the game is this what your looking to do?
Image
B
25
S
14
G
12
Posts: 290
Reputation: 9,402

Post » Sat Jun 24, 2017 12:41 am

THANKS!
It works great now. Thanks for helping me out! :D

99Instances2Go wrote:https://www.dropbox.com/s/t5mv8o10zh4l3i2/OPen%26Close.capx?dl=0

Use the same trigger only once, and 'else' is essential.
B
3
S
1
Posts: 2
Reputation: 279


Return to How do I...?

Who is online

Users browsing this forum: No registered users and 1 guest