Object Indexing in Expressions Not Working

Bugs will be moved here once resolved.

Post » Thu Apr 17, 2014 4:16 am

Problem Description
According to the manual, using an object's IID in parenthesis in an expression should specify that particular instance (i.e. Sprite(2).X to refer to the Sprite with IID 2), but these expressions seem to always be accessing the 0th index, regardless of the number specified.

Attach a Capx
https://www.dropbox.com/s/p6fevqb3h2jpz ... nsBug.capx

Description of Capx
This capx begins with one instance of Sprite at (400,400) and creates a second instance at (200,200), then it records each of their x positions using Sprite(0).X and Sprite(1).X into the two labels on screen.

Steps to Reproduce Bug
  • Run the capx.

Observed Result
Both labels describe the Sprite's X value at 400.

Expected Result
The label for the first sprite should read 400, but the label for the second should read 200.

Affected Browsers
  • Chrome: (YES)
  • FireFox: (YES)
  • Internet Explorer: (YES)

Operating System and Service Pack
Windows 7 Service Pack 1

Construct 2 Version ID
Beta Release r167
B
11
S
2
Posts: 3
Reputation: 1,072

Post » Thu Apr 17, 2014 10:28 am

Closing as not a bug: newly created instances do not really exist until the end of the next top-level event (or trigger). Add 'wait 0 seconds' between the 'set text' actions and it works.
Scirra Founder
B
387
S
230
G
87
Posts: 24,249
Reputation: 192,240

Post » Thu Apr 17, 2014 5:30 pm

Oh, goodness, thank you! As much as I hate to post a bug in my own ignorance, I'm sure glad not to have to wait for the next update to use that function! Sorry about that.
B
11
S
2
Posts: 3
Reputation: 1,072


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 4 guests