Having Issues with Integer Attributes

Hello forum!

Thanks for all your help - I have learned a lot on here. I am having problems with what I think should be a simple fix. I have boiled my problem down to a basic example:

I have a white actor. I have a game "score" integer attribute. I want that score attribute to increase by 1 each time I click the white actor.

When the score attribute equals 1, I want to spawn a red actor.
When the score attribute equals 2, I want to spawn a green actor.
When the score attribute equals 3, I want to spawn a blue actor.

How would you go about achieving this in the simplest way?
For some reason I cannot properly build this in Gamesalad
The colors don't matter of course, they are just there to distinguish one actor from another.

Thank you to everyone.
-Matt

Comments

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    First make a rule to add to the score.

    When touch is released

    Change attribute game.score to game.score+1


    Rule

    Make three other rules as follows

    When attribute game.score = 1

    Spawn red actor

    Rule

    When attribute game.score =2

    Spawn green actor

    Rule

    When attribute game.score =3

    Spawn blue actor

    I should note this is pretty basic stuff. I would suggest taking the time to watch the videos on the cookbook YouTube page.
  • matthattarmatthattar Member Posts: 2
    Hey FryingBaconStudios,

    Thanks so much for taking the time to help.

    I have watched the videos and read the cookbook as well as everything T-Shirt Booth has done, and I think I am slowly grasping the way things need to be broken down in Gamesalad.

    Where I was getting caught is that I was squeezing the "spawn red actor" into the first rule ("when touch is released"..."change attribute"...AND "spawn red actor") rather than giving it its own rule. Then it was causing problems for me later on. I think I have a better grasp of what to do now. My game is more complex than these parts that make it up and sometimes I just get stuck on these small things and need a nudge in the right direction.

    Thank you again for your help!
    -Matt
  • CasguiaCasguia Member Posts: 7

    @matthattar said:
    Hello forum!

    Thanks for all your help - I have learned a lot on here. I am having problems with what I think should be a simple fix. I have boiled my problem down to a basic example:

    I have a white actor. I have a game "score" integer attribute. I want that score attribute to increase by 1 each time I click the white actor.

    When the score attribute equals 1, I want to spawn a red actor.
    When the score attribute equals 2, I want to spawn a green actor.
    When the score attribute equals 3, I want to spawn a blue actor.

    How would you go about achieving this in the simplest way?
    For some reason I cannot properly build this in Gamesalad
    The colors don't matter of course, they are just there to distinguish one actor from another.

    Thank you to everyone.
    -Matt

    Similar situation but how would you go about when you are to choose a specific color you gain points but when the wrong color is chosen its game over. The color you are to choose is randomly changed every few seconds by a pop up text.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    For that you're going to need to track what color it is. You could make a self attribute and change it's number based on the color change. Say, red = 1, blue = 2 et.... And then make that integer part of the scoring rule. It's all logic so just think logically when coding.

Sign In or Register to comment.