How to change image on actor b when rule met on actor a
a1000miles
Member Posts: 36
I am very new to GS.
On an options screen I want the user to have the choice between 15 30 60 90 seconds so I created 4 different actors for each option and used a change image to a tick if one is pressed. A game attribute is set to the appropriate value.
Is there a nice way to get rid of the previous tick - i.e. if it's set to 30 and 60 is pressed, I can get the tick on 60 easily, but how do I remove the tick from 30. I could do it by using one actor and variations of a big image that has all settings but wondered if there is a smarter way to do it!
On an options screen I want the user to have the choice between 15 30 60 90 seconds so I created 4 different actors for each option and used a change image to a tick if one is pressed. A game attribute is set to the appropriate value.
Is there a nice way to get rid of the previous tick - i.e. if it's set to 30 and 60 is pressed, I can get the tick on 60 easily, but how do I remove the tick from 30. I could do it by using one actor and variations of a big image that has all settings but wondered if there is a smarter way to do it!
Comments
I still would like to hear if there is another smarter way of doing it though
Rule: when game attribute = 15
do change image to tick
else change image to no tick
repeat this for each actor with the appropriate values.
Ideally the four actors are just instances of one prototype actor (and maybe this is what you have done). In this case you have 2 options:
Option 1:
Add an attribute to the prototype actor, lets say NumOfSeconds.
Now select each of the 4 instance actors on your scene and change the NumOfSeconds according to its appropriate value.
Then add a rule to the prototype actor:
when game.SelectedNumOfSeconds (this you already have) = self.NumOfSeconds
do change image to tick
else change image to no tick
Option 2: (a bit messy but highlights how to access one actor from another)
Unlock each of the four instance actors, this will give them access to all of the other actors on your scene.
Now you can build rules to change the image in the other actors from the one touched by changing the attribute under Scene.layers.Actorlayer.actors.actorName.Image
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
Still have a look at my suggestions, resetting the scene is not elegant
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
The layers thing looks good. I might go see if I can find a youtube video on layers in GS (that's pretty much how I am teaching myself how to do all this!).
Thanks @Hopscotch .. I appreciate your help.
I think it didn't work for you because you probably added the above into your existing touch rule?
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com