Change instance variable in spawned sprite won't work.

Get help using Construct 2

Post » Sat Jun 14, 2014 1:09 pm

Hello, I have a problem altering an instance variable. I've spawned 7 sprites on the layout, each with 2 instance variables. In a function, I pick a sprite with a particular variable set (var1 = 0) and try to change var2 of that instance. It never works. I've added a text field on the pick event and set the text to change if picked, and it changes, so I suspect the instance is being picked, but the var2 just stubbornly refuses to cooperate. Am I missing things?
B
5
S
1
Posts: 8
Reputation: 291

Post » Sat Jun 14, 2014 4:51 pm

If you spawned all 7 with the same variables, and then try to pick using a variable that is the same on each 1, its going to pick them all. I think you need to set the variable when you spawn it.
B
6
S
1
Posts: 51
Reputation: 502

Post » Sat Jun 14, 2014 4:59 pm

thanks. the variables were set on spawning, and are different for each. and as mentioned it seems to pick the sprite fine via this variable, but after picking the instance i need to modify, i just cant set the other variable.
B
5
S
1
Posts: 8
Reputation: 291

Post » Sat Jun 14, 2014 5:16 pm

hope it helps
You do not have the required permissions to view the files attached to this post.
B
6
S
1
Posts: 51
Reputation: 502


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 7 guests