I dont know what im doing wrong

Get help using Construct 2

Post » Wed Jan 30, 2013 1:57 am

Here's what im trying to do.

There are 3 rooms; A, B, and C.

Room A is the room with the switch.

The switch, if pressed while Variable=0, sets variable to 1

If pressed while Variable=1, it sets the variable to 0

If the variable=0 and you hit the arrow on screen, you go to room B.

If the variable=1 and you hit the arrow on screen, you go to room C.

I set it up perfectly and you only go to room B. Help?
B
4
S
1
Posts: 7
Reputation: 1,279

Post » Wed Jan 30, 2013 2:25 am

Hi

The problem (as far as i understand) is that u set the variable to 1 if the switch is pressed.
Now in my experience u dont want to "set" the switch to 1.
Because construct2 recognises u pressing the switch even after it has set that variable.
The result is this:

Pressed switch --> set variable to 1 --> set variable to 0

So when u then hit the arrow on screen, u go to Room B.

To make switches using variable i always do the following.
I came up with this method after having the same problem long time ago.

Here is what i do all the time and it works.

Press switch --> Add 1 to variable
Variable = 0 (Do Action)
Variable = 1 (Do Action)
Variable is greater or = 2 (set variable to 0)

This event logic makes the switch cycle through the variable, and by reaching the end it starts at Zero again.

With this u can make as many variable actions as u need.

Press switch --> Add 1 to variable
Variable = 0 (Do Action)
Variable = 1 (Do Action)
Variable = 2 (Do Action)
Variable = 3 (Do Action)
Variable = 4 (Do Action)
Variable = 5 (Do Action)
Variable = 6 (Do Action)
Variable = 7 (Do Action)
Variable = 8 (Do Action)
Variable is greater or = 9 (set variable to 0)

U can also use these variable "amounts" in other events.

In your case it would look like this.

Press switch --> Add 1 to variable
Press Arrow & Variable = 0 (Room B)
Press Arrow & Variable = 1 (Room C)
Variable is greater or = 2 (set variable to 0)

Ps: My name is not david either
Kind RegardsSavvy0012013-01-30 02:30:14
B
56
S
20
G
13
Posts: 778
Reputation: 13,204

Post » Fri Feb 01, 2013 3:30 am

thank you so much!
B
4
S
1
Posts: 7
Reputation: 1,279


Return to How do I....?

Who is online

Users browsing this forum: flemmig and 32 guests