Toggle

For questions about using Classic.

Post » Thu Jul 01, 2010 3:21 am

Okay, so after a long hiatus away from Construct I return and find myself completely stumped by some very simple problems. The first being: why the hell doesn't this toggle a global variable? It works if you disable one sub-condition, but not both. But the second one shouldn't be triggered... So now I'm very confused.

http://dl.dropbox.com/u/1378330/wat.cap

Thanks in advance.

EDIT: I think for some reason both events are triggering at once, but I don't know why.
B
55
S
12
G
8
Posts: 339
Reputation: 9,314

Post » Thu Jul 01, 2010 4:52 am

Your cap does exactly what you ask it for :mrgreen:

The problem is that the two subevents are run one after the other right away. This is what happens in one frame when you click:

First subevent
The global equals zero, so the action is performed setting the global to one.

Second subevent
The global now equals one, so the action is performed, too, resulting in the global being set to zero again.


Solution:
If you just need a simple state (0 and 1), instead of the event with two subevents just use the following one.
+On left clicked on Sprite
->Set global to 1-global
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Thu Jul 01, 2010 1:44 pm

I was just reading about this, here:

[url:3is69zio]http://www.scirra.com/forum/viewtopic.php?f=3&t=5748&p=45933&hilit=toggle#p45933[/url:3is69zio]
B
3
G
2
Posts: 35
Reputation: 745


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests