Button Changes Other Images

xtiaanxtiaan Member Posts: 4
edited November -1 in Tech Support
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.

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    For the first part, you need to use global game attributes to achieve that, like this:

    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
  • xtiaanxtiaan Member Posts: 4
    Great - thanks Joe, its rather easy when you know how. I appreciate it.

    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
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Oh yes, that is a fun time! I would love to be able to turn on/off and lock layers for that very reason. For now, the best you can do is right above the Actors panel is a Game/Scene tab. Switch to Scene and click on Layers. There you can see all of your assets. You can reorder their stacking order. So I would reorder the stacking order, edit what you want to edit, and then restore their proper order.
  • xtiaanxtiaan Member Posts: 4
    Cool - thats what I was doing. I guess we'll look for that feature in future updates :)
Sign In or Register to comment.