Self variables adding to another variable?

jheikkagmailcomjheikkagmailcom Member Posts: 1
edited September 2012 in Working with GS (Mac)
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?




Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    You need to change the condition from When Mouse is Down to When Touch is Pressed. Mouse is Down means that the mouse button was clicked or the device screen was tapped anywhere, whereas Touch is Pressed means that the mouse button/tap occurred within the boundaries of that individual actor.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.