OnKeyPressed descoping globals

Bugs will be moved here once resolved.

Post » Sun Jun 23, 2013 4:11 pm

Link to .capx file (required!):
http://bht.hostingsiteforfree.com/bugs/OnKeyPressedGlobalScope.capx

Steps to reproduce:
1. Press down arrow
2. Press up arrow

Observed result:
Down arrow only rotates red block, not green.
Up arrow rotates green and yellow.

Green block uses global. Red block checks global inside scope of OnKeyPressed. Yellow block uses instance variable on green block.

Expected result:
Green block should always rotate as Variable1 is set to 1 in both cases (OnKeyPressed and KeyIsDown).

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

Operating system & service pack:
Win7 SP1

Construct 2 version:
    132 & 135
ImageImageImage
B
71
S
22
G
240
Posts: 3,734
Reputation: 133,994

Post » Mon Jun 24, 2013 5:49 pm

Closing as not a bug. Triggers do not fire in the order the events are shown in the event sheet. In this case 'On down arrow pressed' fires, then 'Every tick' sets both variables back to 0.
Scirra Founder
B
397
S
236
G
88
Posts: 24,423
Reputation: 194,560


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 1 guest