Change instance variable in spawned sprite won't work.

0 favourites
  • 4 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • 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?

  • 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.

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • hope it helps

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)