control the visibility of one actor with another actors button state?

xyloFUNxyloFUN Member Posts: 1,593
edited November -1 in Working with GS (Mac)
tricky stuff .... google finds two posts in the forum that touch this, each different but both only discuss the theory behind it without practical example.

So, how would I control the visibility (alpha) of one actor when I press another actor?

If there is a tut that covers this, please post me a link as I will use this a lot!

cheers :)

Comments

  • juzcookjuzcook Member Posts: 259
    You'll need a boolean game attribute to do this. Call it something like "ShowActor"

    On the actor you're pressing:

    -----
    Rule
    When touch is pressed: Change attribute game.showactor to True

    Otherwise: Change attribute game.showactor to False
    -----

    Then on the actor you want to be visible:

    -----
    Rule
    When Attribute game.showactor is True
    Change Attribute self.alpha (under colour menu) to 1

    Otherwise Change Attribute self.alpha to 0
    -----

    That's all that should be involved :)
  • xyloFUNxyloFUN Member Posts: 1,593
    juzcook,
    THANK YOU ... it's been a long day (and a good one to say the least) I didn't think that I would make so much progress today but this visibility issue had me really stumped!

    Anyway, I'm going to work on that tomorrow because I can hardly keep my eyes open. I played with my test builds all evening! LOL

    Again, thanks for that solution! If I can make that work, I will be able to do a lot more with GS :)
  • xyloFUNxyloFUN Member Posts: 1,593
    Thank you for helping me!

    I've tried a few times, making sure that I enter everything as you describe it but I can not get one actor to hide another actor.

    The only thing I did different was that I named the attributes hideRed and another hideGreen

    The finished product will nee to show/hide a total of seven actors.

    thanks :)
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Try like this. Make a interger attribute, call it invisible or whatever you want. Then go into the actor you want to touch to make the other actor invisible. Make a rule when touch is pressed change attribute invisble to zero. Go into the actor you want to turn invisible when the other one is pressed, and have a rule when attrbute invisible = 0 change attribute color,alpha to 0. If that works for you ill tell you how to tweak it to your likeing.
  • xyloFUNxyloFUN Member Posts: 1,593
    Thank you John,
    I will test that in a minute!

    Right now, the black part of the screen becomes transparent as soon as I test the game so i have to restart GS!

    .... if you're still around in 10 minutes or so, I'll let you know if it worked :)
  • xyloFUNxyloFUN Member Posts: 1,593
    As I was reading your suggestions, I realized that I did not do a good job of describing what I really need!

    I am actually using one actor to hide and unhide another one! Sorry about the confusion ...

    How ever, you gave me new food the chew on so maybe i can get something going ....
  • xyloFUNxyloFUN Member Posts: 1,593
    John,
    doing two quick tests, id did not produce the results I'd hoped for. I also wish that GS would take that "Alpha" tag out of the Color settings ... just to speed things up a bit. But with that I can live .... the trick is to get the alpha values to behave!
    Amazing how Flash makes that so easy! LOL

    with ether way that was described, I can how ever hide. Just to unhide is tricky at this point!
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Yes, im playing around with it and its being a pain. I can get it to hide while touch is pressed and then once its released it becomes visible again if thats what you mean. But if you mean like touch once it hides it, then you go back and touch it a second time it becomes visible again, thats what im tryin to work on now.
  • xyloFUNxyloFUN Member Posts: 1,593
    WOW John,
    you made much more progress than I have!

    I would be happy to hide with touch and unhide with "outside" and released!

    How did you do it?
  • xyloFUNxyloFUN Member Posts: 1,593
    To illustrate a little better what I want to do, you can take a quick look at this youtube video I've made a while ago. It shows the Flash version ... well, an old one because the new instrument which I am working on for the ipad/iphone is silver!



    Basically, I need to copy the same functionality as seen in the video :)
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Try this. Make a interger attribute, call it invisible or whatever have it set to 0 . Then go into the actor you want to touch to make the other actor invisible. Make a rule when touch is pressed change attribute invisble to 1. Then make a rule when touch is released change attribute invisible to 0. Go into the actor you want to turn invisible when the other one is pressed, and have a rule when attrbute invisible = 1 change attribute color,alpha to 0. The go under that into the otherwise section of that same rule and have constrain attribute color alpha to 1
  • xyloFUNxyloFUN Member Posts: 1,593
    John,
    I will definitely try that! Thanks for taking the time and working that out ... that is very nice of you! WOW

    It's 1:31 am in Vancouver and I can't keep my eyes open anymore and besides, last night (about the same time) I woke my wife up with that stupid cheer/applause GS puts on when finishing the export!

    Plus, I need to power down anyway because adding 7 sounds and all the gfx for the instument and notes is slowing GS down to an almost unworkable level ...

    I'll report back tomorrow and tell you how it went :)
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    No problem, its 4 30 am where i am ive been up working all night and had to much coffee, and can use a change of pace :) What i just told you to do will do what you want too, so you should be good to go. If for some reason it doesnt work let me know and ill email you a sample project, because i got it working. Let me know what happens
  • xyloFUNxyloFUN Member Posts: 1,593
    John,
    you did it! THANK YOU!

    Now I have almost all of my Flash functionality back! YAY!!
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    No problem, glad i could help :)
Sign In or Register to comment.