"For each" and "load image" : what do I miss ?

Discussion and feedback on Construct 2

Post » Fri Oct 11, 2013 6:03 pm

Hello !
I need your help in this code :
https://dl.dropboxusercontent.com/u/11014243/For%20each.capx

Basically, my code is :

For each Sprite :
              Sprite : load image ("Icon"&str(loopindex))

I expected to get "Icon0" for the first instance, "Icon1" for the second one, and eventually "Icon2" for my last instance. But all my instances load "Icon2".
Why ? Is it because the loading process is too slow for a loop ?
B
5
S
1
G
1
Posts: 6
Reputation: 994

Post » Fri Oct 11, 2013 6:11 pm

Okay... I understand...
I can't change the image of just ONE instance of a sprite. Every instance is automatically changed. It's normal.
I'm sorry for my mistake...
B
5
S
1
G
1
Posts: 6
Reputation: 994

Post » Fri Oct 11, 2013 6:20 pm

[QUOTE=Surmulot]Why ? Is it because the loading process is too slow for a loop ?[/QUOTE]

Bingo.
There is an "On image loaded" trigger for sprite you can try.
Also it will work for tiled background.newt2013-10-11 18:21:46
Image ImageImage
B
168
S
50
G
164
Posts: 8,227
Reputation: 105,573


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 3 guests