Self variables adding to another variable?
![jheikkagmailcom](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
Very beginner question.
I have a Prototype Actor, which creates a box and then assigns a random number as into a self attribute and then displays that number using Display Text. I can add any number of Instance Actors based on the prototype actor to the scene and they all show random numbers as expected.
I have game attribute called game score, which is displayed inside another (Game Score) Actor in the scene.
I want to add code to on mouse click adds the number value from specific instance of the Actor 1 to the game score actor and updates the display within the Game Score actor. However when specific instance of Actor 1 is clicked all the values from every instance is added to the Game Score (vs. just the value of the specific instance).
The rule for mouse click down is currently (within Prototype Actor):
Change Attribute: game.Game score to game.Game score + self.Value
Why does each instance show their own self value correctly, but when clicked all self values are added up?
I have a Prototype Actor, which creates a box and then assigns a random number as into a self attribute and then displays that number using Display Text. I can add any number of Instance Actors based on the prototype actor to the scene and they all show random numbers as expected.
I have game attribute called game score, which is displayed inside another (Game Score) Actor in the scene.
I want to add code to on mouse click adds the number value from specific instance of the Actor 1 to the game score actor and updates the display within the Game Score actor. However when specific instance of Actor 1 is clicked all the values from every instance is added to the Game Score (vs. just the value of the specific instance).
The rule for mouse click down is currently (within Prototype Actor):
Change Attribute: game.Game score to game.Game score + self.Value
Why does each instance show their own self value correctly, but when clicked all self values are added up?
Comments
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User