Left Right keys Bug ?

Bugs will be moved here once resolved.

Post » Mon Dec 16, 2013 11:45 am

Link to .capx file (required!):
https://dl.dropboxusercontent.com/u/13847313/Scirra/LeftRightKeys_Bug.capx

Steps to reproduce:
1. Press Right key to go to number 2
2. Try to go from left to right and right to left.
3.

Observed result:
It goes directly from 1 to 4 from left to right BUT it works fine from right to left. The code is exactly the same.

Expected result:
By pressing the Right key, it should go to the next number and not the last one.

Browsers affected:
Chrome: yes
Firefox: yes
Internet Explorer: yes

Operating system & service pack:
W7 pro
Service pack 1
Construct 2 version:
R154 (but I haven't tried with the old versions)    
B
72
S
21
G
12
Posts: 314
Reputation: 12,111

Post » Mon Dec 16, 2013 5:00 pm

Odd, if you change it to key released instead of pressed it works fine... wonder if key pressed isn't just triggering once...
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,583

Post » Mon Dec 16, 2013 5:50 pm

@BluePhaze Nop, it doesn't work neither. (I tried it too)
The same issue appears.

CAPX with 'key released' version
B
72
S
21
G
12
Posts: 314
Reputation: 12,111

Post » Mon Dec 16, 2013 9:19 pm

Odd, it works on mine if I do on key released for right, and on key pressed for left...
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,583

Post » Mon Dec 16, 2013 11:56 pm

Well I hope this is really a bug and I will not have to strangely mix pressed and released to make it work. ;)
B
72
S
21
G
12
Posts: 314
Reputation: 12,111

Post » Tue Dec 17, 2013 2:53 pm

Not a bug, you need to use the "else" condition. Otherwise when you press the right arrow key events 1, 3 and 5 all immediately fire one after another.
Scirra Founder
B
395
S
233
G
88
Posts: 24,376
Reputation: 193,842

Post » Tue Dec 17, 2013 3:30 pm

@Ashley mmmmm...is it normal it doesn't do the same thing for the left ?
B
72
S
21
G
12
Posts: 314
Reputation: 12,111

Post » Tue Dec 17, 2013 7:12 pm

Yes, it's a perfectly logical consequence. Look carefully at the order of your events and remember triggers fire in top-to-bottom order.

Subevents are great for this kind of thing - you really should only have one trigger for each key and a bunch of subevents using "else". Not only will it read more clearly, but you'll avoid this problem!
Scirra Founder
B
395
S
233
G
88
Posts: 24,376
Reputation: 193,842

Post » Tue Dec 17, 2013 9:05 pm

@Ashley Thank you for your explanation. I think now I'm starting to understand why it doesn't work. (But I haven't finished to compile that idea in my head ^^ )

After severals tries, I finally find out how to use the ELSE in that situation and it works! Thanx. :)

Here is a CAPX for those who can be interested in :

CAPX ResolvedKaMiZoTo2013-12-17 21:05:47
B
72
S
21
G
12
Posts: 314
Reputation: 12,111


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 5 guests