Change tags during the game, and get collisions working

IsabelleKIsabelleK Member, Sous Chef Posts: 2,807
edited July 2012 in Working with GS (Mac)
Hi!
I need to change tags inside the game, and this works. But I have a different problem:
I have two tags: NonMovable, and Movable - all player actors are inside the NonMovable tag. I want them to change their tags, when they move - this is simple, and it works.
But after changing tag to Movable, one of my rules doesn't work:
If actor overlaps, or collides with actor with tag Movable, change attribute game.Touched to true.

Does anyone know, if I made something wrong, or if there is a workaround for this? I can't use game attribute for each actor.

Best Answer

  • MotherHooseMotherHoose Posts: 2,456
    Accepted Answer
    defined Tags for all actors are gameAttributes (globalAttributes)

    an actor can have a tag that is defined/changed during runTime
    but … it is a selfAttribute that is readable only by that actor
    (well, also by an unlocked actor that can read thatActor's attributes)

    therefore the actor with the changedTag should control the collision

    Rule: when (All)
    Event: overlaps or collides with actor (the other actor)
    Attribute: self.Tags = Moveable
    -changeAttribute: game.Touch To: true

    ==
    or if it is more functional in your situation:

    Home: Actors … and add 2 tags … moveable and non-moveable
    drag the Actor into both Tags

    then on the Actor's prototype:
    Rule: when
    Event: touch is pressed
    -changeAttribute: self.Tags To: moveable
    Otherwise: changeAttribute: self.Tags To: non-moveable

    this will allow lockedActors to interact with that actor's tags
    as both states will be accessible as gameAttributes

    image MH

Answers

Sign In or Register to comment.