1 Button doing 2 things!

Get help using Construct 2

Post » Mon Apr 15, 2013 4:15 am

Greetings there! I have been searching for this for a while and been trying aswell, but can't get it to work tbh.

I want 1 button to do several things depending on what.

For example C opens inventory (like in wow) - but if its already opened it should be closed. - Here is the problem because on 'pressing C' it doesn't let me add an 'else' right after! Why? :/

Some help please - and thanks for your time and this awesome community!
B
5
S
1
Posts: 70
Reputation: 809

Post » Mon Apr 15, 2013 4:30 am

This is a job for sub-events! Create your key press condition

On C Pressed.       Now right-click on it and add a sub event (I think S is the shortcut). Now add your other conditions
-------Box.Whatever = "closed" | open the box, set box.whatever to "open"
-------Else | close the box, set box.whatever to "closed"

The indentations help your know you're in a sub event. Basically, when you press C, it then triggers evaluating the other conditions. How you were trying before wouldn't work because the "else" of on C pressed is infinite. Sub events fix this by letting you run multiple layers/tiers of conditions off of one action.

I hope that solves it for you!
B
90
S
32
G
14
Posts: 935
Reputation: 14,540

Post » Mon Apr 15, 2013 4:46 am

Oh wow dude! It surely worked fine! Thanks alot for your epic and sexy answer ;D - cant believe this community is.. almost perfect! Makes me sad in a way to see such helping people - well ofc sad due to happiness indeed ;D thanks yet again!
B
5
S
1
Posts: 70
Reputation: 809


Return to How do I....?

Who is online

Users browsing this forum: DemantDigitalArt and 20 guests