[RESOLVED] Sub-event logic??

Get help using Construct 2

Post » Mon Feb 25, 2013 12:34 am

Hi guys, I'm having trouble to understand the Sub-events. I read the manual. Obviously following structure should work... but unfortunately it didn't. On doubleclick over each of the boxes, it should change its color and display the click status. Could someone take a look and say what is wrong??



C2 file also here:
Doubleclick Problem

ThanksXManBG2013-04-02 13:16:00
B
11
S
3
G
3
Posts: 79
Reputation: 3,343

Post » Mon Feb 25, 2013 12:52 am

Because it contradicts itself

If you clicked Sprite with 0 it sets frame 1 but also it goes back to 0 instant

there a way to fix it to add wait 0.1 second to each subevent

I don't think i can help to text, it seems bad practice
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,644

Post » Mon Feb 25, 2013 12:55 am

@XManBG

Add "else" at condition "click != 0".
B
97
S
22
G
178
Posts: 4,121
Reputation: 104,049

Post » Mon Feb 25, 2013 10:58 am

Thanks for the "Else" tipp. Although according to the Manual Sub-Events: https://www.scirra.com/manual/128/sub-events should work my way too, therewith the color successfully changed on doubleclick...

But the text doesn't :( .

My understanding for the sub-event was, that it uses the same starting event, i.e. Nr.2 on the picture, and executes the sub-events all at once... or maybe in a row?! Anyway, the Text sub-event Nr.5 should work for both cases.XManBG2013-02-25 11:09:13
B
11
S
3
G
3
Posts: 79
Reputation: 3,343

Post » Mon Feb 25, 2013 11:31 am

Try adding for each text - condition before your variable comparison.
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Mon Feb 25, 2013 2:38 pm

You need some extra brackets in there:
[code]
"Clicked?: "&((Sprite.Clicked=0)?"NO":"YES")
[/code]
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Mon Feb 25, 2013 10:19 pm

SOLVED: Now that works. Obviously the missing parentheses were the problem. Thanks a lot!!

XManBG2013-02-25 22:22:13
B
11
S
3
G
3
Posts: 79
Reputation: 3,343


Return to How do I....?

Who is online

Users browsing this forum: spcsmrf and 21 guests