how to detect if an attribute image has changed
DigitalCaesar
Member Posts: 40
in order to make my game work properly I need to have something that detects in an image or an attribute has changed. Please help.
Comments
An image in your game won't change unless you tell it to change, so when you tell it to change also update a custom attribute called 'image changed', or whatever you like. Then you can check the status of that attribute when you need too.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
@DigitalCaesar, you can query the self.image attribute of an actor. Use it as a text string.
Rule (Text Expression) self.Image contains "whatever"
Why do you not set a global attribute at the time when the image changes and act on that?
Chaining rules (When A happens do B, when B happens do C, etc.) will cause problems down the road, as well as making your game difficult to maintain. It would be better to say when A happens do B and C.
MESSAGING, X-PLATFORM LEADERBOARDS, OFFLINE-TIMER, ANALYTICS and BACK-END CONTROL for your GameSalad projects
www.APPFORMATIVE.com
@Hopscotch what do you mean by global attribute?
In GameSalad, global attributes (attributes that can be "seen" by all actors) are called "game attributes." So something like game.Time or game.HasThisHappened (a custom boolean attribute) are available globally.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Ok thanks.
I was hoping to do something like
if the image or attribute changes
and the user does not click any buttons
then the scene changes to another scene
Right but do you understand this?
When you say "if the image changes" what exactly do you mean? Can you explain how your game might work and why an image might change? That will probably help us understand better what you're trying to do.
As it is, if you have an actor with an image it's never going to change. So what action in your game would cause the image to change? How would you fill in this sentence:
If __________ then change the actor's image from ___________ to _____________.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I made a random number generator and every couple seconds it would change an image. Then the user has to tap the right buttons in order to win the game. Although in my game if the user does tap any buttons then the game keeps going on and the player can win my game by doing nothing.
Yes I understand the image won't change unless I want it to change, I made the number generator change images according to the integer attribute I gave them.
Thanks for your help.
I think to solve that I need a boolean attribute, If user presses button then true if user doesn't press any buttons then false. Like if the attribute or image changes and the boolean is false then you lose.
If I understand correctly, you're saying that if the image changes then the player loses.
I would do away with the need for a boolean and just use a timer. Something like this:
Timer every 2 seconds
Change attribute self.Image to random(1,10)
Timer after 2 seconds
Change Scene [You Lose scene]
So if the player presses a button, should the image stop changing or does the player then have another two seconds to press a button before they lose?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
The user would have an amount of time to press the correct button or they lose.
The basics of the game is
There will be an actor that displays a image.
If the user does not tap on the correct image in a certain amount of time then the user loses
So the player has to distinguish if one of multiple actors have changed like a spot the difference game?
Ok I got it figured out I did some work with the timer idea that @tatiang had and I is up and running. Thanks for Helping!