Problem with disappearing the actor

alarm656alarm656 Member Posts: 291
edited November 2012 in Working with GS (Mac)
Hello, in my game I have 2 actors when I touch the first actor the second actor will be appear (true, change Alfa color to 1). How to disappear the second actor by double pressing first actor or when appear is true ...please help

Comments

  • LooseMooseLooseMoose Member Posts: 224
    In this example lets call your boolean attribute 'visible'

    When Actor 1 receives touch, if 'visible' = false change 'visible' to true
    When Actor 1 receives touch, if 'visible' = true change 'visible' to false

    In actor 2
    If visible = true change alpha color to 1
    else change alpha color to 0
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited November 2012

    @alarm658

    Hi, as @Kyukon says; and here it is with a bit more detail (changing the name of the boolean, let's call it A2vis; so if you've more "pairs" you can name the other ones B2vis, C2vis, etc)

    In your first actor:

    Rule: When touch is pressed
    Rule: (nested in above) When A2vis is false
    Change Attribute A2vis to true
    Otherwise
    Change Attribute A2vis to false

    In your second actor:

    Rule: When A2vis is true
    Change Attribute self.Color.alpha to 0
    Otherwise
    Change Attribute self.Color.alpha to 1

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    This thread has a useful way of implementing a double-tap with a timer: https://forums.gamesalad.com/discussion/16032/double-tap-on-the-screen.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • alarm656alarm656 Member Posts: 291
    edited November 2012
    In this example lets call your boolean attribute 'visible'

    When Actor 1 receives touch, if 'visible' = false change 'visible' to true
    When Actor 1 receives touch, if 'visible' = true change 'visible' to false

    In actor 2
    If visible = true change alpha color to 1
    else change alpha color to 0
    Thanks, but I also tryied like that.Not works((. In this position I need timer behavior because when you press the actor second actor will be appear and will sudenly disappear)) You will not even see the change))
  • alarm656alarm656 Member Posts: 291

    @alarm658

    Hi, as @Kyukon says; and here it is with a bit more detail (changing the name of the boolean, let's call it A2vis; so if you've more "pairs" you can name the other ones B2vis, C2vis, etc)

    In your first actor:

    Rule: When touch is pressed
    Rule: (nested in above) When A2vis is false
    Change Attribute A2vis to true
    Otherwise
    Change Attribute A2vis to false

    In your second actor:

    Rule: When A2vis is true
    Change Attribute self.Color.alpha to 0
    Otherwise
    Change Attribute self.Color.alpha to 1

    I think that it will be best way if I create 3 Actors. when I press 1A to appear 2A and when I press 3A disappear 2A.))) Sorry in my game it will like Inventory. Any comments please.......
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited November 2012

    Hi, I'm not fully understanding what you're need now, to be honest, as the Inventory analogy confused me... (when picking an item from an inventory it's usual to have it highlighted, or similar, the other items remaining as they are).

    But you want what you want, so first a bit more info please and I or another member can sort it for you.

    So have I got it right the effect you're after?: You've one actor on screen, lets call it A. You press A and B appears, A disappears. If you press B, C appears and B disappears. If you press C, D appears and C disappears, etc. Is that what you're after?

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • alarm656alarm656 Member Posts: 291

    Hi, I'm not fully understanding what you're need now, to be honest, as the Inventory analogy confused me... (when picking an item from an inventory it's usual to have it highlighted, or similar, the other items remaining as they are).

    But you want what you want, so first a bit more info please and I or another member can sort it for you.

    So have I got it right the effect you're after?: You've one actor on screen, lets call it A. You press A and B appears, A disappears. If you press B, C appears and B disappears. If you press C, D appears and C disappears, etc. Is that what you're after?

    hi, so i need to create 4 Actors (A,B,C and D). when I press A than B will appear but A will disappear. when I press B than C will appear but B will disappear. when I press C ......
    Is it routine? I want to disappear inventory. When I pressed the suitcase next to it appeared inventory. Now what I want, I want to disappear the inventory by again pressing the suitcase or by double pressing suitcase)))
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited November 2012

    So you have a suitcase that opens and closes an inventory. So, when this inventory is open it only shows the first item, even if there's more than one item in there? And when you choose it, it disappears and the next one appear, etc?

    I'll show you how that can be done but first can I make a suggestion: forget the items appearing only when the one before has been pressed; so what you have is a suitcase when pressed, all your items in the suitcase appear at once (allowing you to press on one to highlight/drag or use it) and when the suitcase is pressed again, all the items disappear. This way seems to make more sense to me....

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • alarm656alarm656 Member Posts: 291
    Yes, you are writing my mind))) Yes there is should be more than one item. I want choose one item and want to drag it to desired place. closing inventory mmm are you meaning when I choose the item than inventory will be closed?
  • alarm656alarm656 Member Posts: 291

    @alarm658

    Hi, as @Kyukon says; and here it is with a bit more detail (changing the name of the boolean, let's call it A2vis; so if you've more "pairs" you can name the other ones B2vis, C2vis, etc)

    In your first actor:

    Rule: When touch is pressed
    Rule: (nested in above) When A2vis is false
    Change Attribute A2vis to true
    Otherwise
    Change Attribute A2vis to false

    In your second actor:

    Rule: When A2vis is true
    Change Attribute self.Color.alpha to 0
    Otherwise
    Change Attribute self.Color.alpha to 1

    Thanks here seems me I need timer, because when I press A1: A2 will visible. When I realease the A1: A2 unvisible))

  • LooseMooseLooseMoose Member Posts: 224
    In this example lets call your boolean attribute 'visible'

    When Actor 1 receives touch, if 'visible' = false change 'visible' to true
    When Actor 1 receives touch, if 'visible' = true change 'visible' to false

    In actor 2
    If visible = true change alpha color to 1
    else change alpha color to 0
    Thanks, but I also tryied like that.Not works((. In this position I need timer behavior because when you press the actor second actor will be appear and will sudenly disappear)) You will not even see the change))
    I made a mistake in my example. here is how rules in actor 2 should be.

    rule 1:
    If visible = true change alpha color to 1

    rule 2:
    If visible = false change alpha color to 0
  • alarm656alarm656 Member Posts: 291

    I made a mistake in my example. here is how rules in actor 2 should be.

    rule 1:
    If visible = true change alpha color to 1

    rule 2:
    If visible = false change alpha color to 0

    YAHOOOOOOOOOOO!!!!!! Perfect!!!! it works excellent!!! Thank You so much!!!
    I think it's time to close the discussion. But I don't know how to))))
    I'll create another discussion about items in inventory))) Thanks a lot!
Sign In or Register to comment.