Trying to get different actors to change images on the same scene

waterjunkywaterjunky Member Posts: 3
edited August 2013 in Working with GS (Mac)
I am new to GS and trying to figure out how to do something that seems like it should be simple to do in one scene rather than referencing many different scenes. I have 20 button actors, which I want to show a different image next to the buttons on touching each button. When a button is pressed, then an image should appear next to the buttons, the button that was pressed becomes highlighted. When a different button is pressed then a different image should replace the last image that appeared, the last button that was highlighted resets to OFF (image), then the new button is highlighted ON (image). I know you can spawn an actor on press of a button, but how do you destroy that spawned actor once another button is pressed to spawn a different actor (or image)? And, how do you change the button highlighting mentioned above? Can this be done all in the same scene or does it need to be separated in 20 different scenes?, i.e. when different button is touched then it goes to another scene to show the related image.

Answers

  • waterjunkywaterjunky Member Posts: 3
    Thanks @a1000miles, I appreciate your insight. Unfortunately, that just scratches the surface of all of the answers I am looking for. In your example, I would need each button to toggle between x20 different images. Each time a button is touched, an image outside of the buttons would be produced, e.g., one button is a picture of an apple and another is an orange, when the orange is touched, the orange button is highlighted and a bigger picture of an orange appears next to the buttons (not inside). When the apple button is touched, it becomes highlighted and the bigger image of the orange is replaced by the bigger image of the apple.
  • a1000milesa1000miles Member Posts: 36
    edited August 2013
    @waterjunky - ok, how about this ..

    The actor which is used to generate the big image has a rule which sets the image depending on an attribute value which is set by each button.

    Something like ..

    when apple button is pressed, change attribute big_image to 1 (big apple)
    when orange button is pressed change attribute big_image to 2 (big orange)
    when pear button is pressed change attribute big_image to 3 (big pear)

    When the buttons are pressed, they spawn a separate big image actor which
    checks the attribute and then uses change image to set the right image
    The big_image actor could be destroyed after a specific time, ready for the next button to be pressed.

    The small buttons could also use a change image to the "highlighted" version and if necessary get switched back using the same timer as the destroy big image actor.

    Not sure if I understand what you are trying to do correctly, so hope this helps.
  • waterjunkywaterjunky Member Posts: 3
    Thanks @a1000miles, what I'm trying to do is much like a photo gallery, i.e. you press on a thumbnail, then the larger photo of that thumbnail appears; that larger photo appears in a specific position on the screen. There should be no timers to destroy an actor (the larger photo), rather the user would change it only when a different thumbnail is pressed. I know the easy way would be to just have a scene for every "larger photo", but I'd really like to find a way to do it in less scenes. I'll give what you suggested a try, although I think I'd still be missing steps.
  • aquamonkeyaquamonkey Member, PRO Posts: 36
    Ok, I think I almost have this all figured out. The only thing left is to figure out a good way to highlight the thumbnails to indicate the image that is selected. Rather than having 1 image for ON and 1 image for OFF I think I might slice an entire image of all of the buttons, use actors as image maps and use Change Attribute to change the background (button panel) in each image map.

    So, here's what I ended up with, which works for me:

    After positioning instances of the same actor for the thumbnail buttons and the actor for the larger image, add the following rules for each of the thumbnail actors in the scene: In a Rule for touch is pressed - Change Attribute/Current Scene/layers/select the name of the Actor where the larger image will appear. To: the name of the image.

  • aquamonkeyaquamonkey Member, PRO Posts: 36
    @a1000miles, FYI, the comment from aquamonkey is the same person as waterjunky! Sorry, waterjunky was my old non-pro membership login. Thanks for your help!
Sign In or Register to comment.