Button Changes Other Images
xtiaan
Member Posts: 4
Hello ~ Sorry if this question is rather simple, but i can't find the answer on the forums. Say I have a button/actor named 'Start'... how do I get several other images in the scene to change when "Start" is clicked/touched?
Also (while im here How would I have an image in the scene (separate from the 'Start' button) fade to another image once that "Start" button is clicked?
I really appreciate any advice.
Also (while im here How would I have an image in the scene (separate from the 'Start' button) fade to another image once that "Start" button is clicked?
I really appreciate any advice.
Comments
Create a global game attribute (boolean) called something like "startButtonHasBeenPressed"
Then, in your start button actor, create a rule like this:
Rule
When Touch is Pressed
Change Attribute: game.startButtonHasBeenPressed To: TRUE
Then, in all of your image changing actors, create a Rule that listens for that event like this:
Rule
When game.startButtonHasBeenPressed = TRUE
Change Image To New Image
For the second part, it's a little tricky to do a cross-fade, but it can be done like this:
You'll need to have two actors, one with the original image, one with the new image.
The one with the new image will need its alpha set to 0.
In the original image actor, add a Spawn Actor behavior. Spawn the new image actor in FRONT of the original image actor.
In the new Image Actor, add a Rule like this:
Rule
When self.alpha < 1
Timer
Every 0.01 seconds
Change Attribute: self.alpha To self.alpha + 0.01
That should get you started!
Hope this helps!
Joe
One related question. I have about 5 or 6 layered PNGs on the stage. I can only click to select the upper most layer, b/c all the layers beneath are 'covered' by the top layer. Is there an easy way to select and edit lower layers on the stage?
Thanks again,
Xtiaan