Change tags during the game, and get collisions working
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.
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
-
MotherHoose Posts: 2,456
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 gameAttributesMH
Answers
http://forums.gamesalad.com/discussion/comment/281170/#Comment_281170