Need Actors to know each others states

tcla75tcla75 Member Posts: 71
edited November -1 in Working with GS (Mac)
Hi I have two actors in one scene and what I'm trying to do is click on one and it will do nothing if the other actor is still on the screen but destroy itself if the other actor is not on the screen. How can I do this without creating a second scene?

Comments

  • calvin9403calvin9403 Member Posts: 3,186
    make an attribute integer, set it to 0
    make an actor, and drag then around the scene
    when overlaps or collide with actor, change attribute to 1
    when touch is press and attribute is 1, destroy this actor

    Calvin
  • tcla75tcla75 Member Posts: 71
    Hi Calvin thanks for your help. I'm still a bit new with GS so need a bit of further info. When you say drag actor around the screen do you mean enlarge the actor to the full size of the screen so it touches everything in that scene?

    Also is it the Actor I just created that I set to when overlaps or collide with actor?

    Finally when you say "change attribute to 1" when I create a new rule for new actor and I select "overlaps or collide with actor" the only option next to it is with "actor of type" What steps do I need to take to change attribute to 1.

    Thanks again as I said I'm a newbe to GS so I do appreciate the help you guys give.
  • calvin9403calvin9403 Member Posts: 3,186
    no drag it around the scene
    use the change attribute behaviors

    Calvin
  • Captain_AverageCaptain_Average Member Posts: 12
    tcla75,

    I think what Calvin is trying to say is...

    In the top left section where your actors are displayed there is a tab called attributes. Open this tab and click the plus sign below in the bottom left corner of the window to create a new attribute of type integer. Call this attribute something like "off screen?"

    You then create a new actor back in the actors tab - "out of scene". It can be a big white block or whatever. Copy it 3 times and "box" your scene in around the edges, so the blocks are not on your viewable area but surrounding it.

    For when your wandering actor goes off the edges.... Make a rule in your "out of scene" actor that says, when actor overlaps or collides with actor of type "wandering actor", and drag a constrain attribute behaviour into the rule's consequence. You're going to want the attribute "off screen?" to constrain to 1 when actor overlaps, otherwise "constrain attribute" to 0.

    Finally, In the other actor that you want to have differing properties, put in a rule that says, when "off screen?" is equal to 1, AND actor receives touch, destroy actor.

    Of course, this depends entirely on the context of what you want these things to do, you may want to be careful of your wandering actor strolling on forever off the edge of the screen and out of your out of scene box or whatever. Also I'm not sure why you would use an integer and not a boolean (true or false - same principle but true and false instead of 1 and 0 for integer) as I've tended to do for most things, but I'm new myself; perhaps an older and wiser member can tell you better, but I think this should work in the meantime...

    Cheers.
  • tcla75tcla75 Member Posts: 71
    Hi Calvin9403 again as I said I am a newbe so I won't understand any instructions other than literal instructions so when you say drag it around scene to me that means click on new actor put it in the scene and then just move it around the scene using the mouse then let go.
    I'm sorry if I sound stupid but drag around scene doesn't mean anything else to me. Also when I create change attribute I don't see an option to change numbers just see game devices actor 1.

    When someone has been using something for a while you can forget that new users won't follow that same train of taught as you and where you wouldn't even think of saying ok click here and then here because its second nature to you to me its not.

    I understand if you don't have time to explain step by step what you mean so if anyone else can explain or link to a tutorial where those steps are in it that would be helpfull.
  • tcla75tcla75 Member Posts: 71
    Hi Captain_Average thanks for this. Actually my two actors won't be moving at all. Basically there will be two balls. One right one left. I will click on the left ball and it will destroy then on the second one and that will destroy also. That I can do but what I am hoping for is if I try to click on the second ball first nothing will happen because the first ball hasn't been destroyed yet. Can that be done with the above instructions. Again thanks to everyone for all the help.
  • tcla75tcla75 Member Posts: 71
    .
  • Captain_AverageCaptain_Average Member Posts: 12
    Ah, well that's a little different, but much the same.

    Make a new attribute of type boolean as per above instructions and call it "Ball 1 Gone?".

    In your behaviours for Ball 1 (left side ball), create a rule that says when actor is touched, destroy actor, and additionally in the same rule, constrain attribute, game---> "Ball 1 Gone?" to true, otherwise, constrain attribute "Ball 1 Gone?" to false.

    Then in Ball 2 (right side ball), create a rule that says when actor is touched, AND "Ball 1 Gone?" is true, destroy actor.

    I think this should work (though I will cover myself by re-iterating I'm a noob myself!) so let us know.

    Cheers!
  • tcla75tcla75 Member Posts: 71
    Thanks Captain_Average will try tonight when I get home from work and let you know.
  • calvin9403calvin9403 Member Posts: 3,186
    I just got back and thanks Captain_Average
    yep that is about it , I think it will work
    this will be useful:http://www.youtube.com/user/GameSaladCookbook#p/

    Calvin
  • Captain_AverageCaptain_Average Member Posts: 12
    All in a day's procrastination gents....
Sign In or Register to comment.