The Difference between Constrain and Change??
Aldo
Member Posts: 53
What's the difference between Constrain Attribute and Change Attribute???
Comments
If you do change attribute actor.x = actor.x+1, the actor will move only one pixel to the right, to never move again until that condition is triggered again.
For instance if you wanted an actor to follow another you would create a game attribute called actor1.x and constrain the self.position.x value of the actor you wish to follow to game.actor1.x
then you can constrain actor2 self.position.x to game.actor1.x-25
Doing this will make actor 2 always be 25px behind actor 1 no matter where actor 1 moves.
f you where to use change attribute instead it would change to 25px behind the current position but would not check actor 1 position again without other actions forcing another check.
I'm not sure that constraining can simply move an actor by itself. I guess in theory it could but this would not be a very good way move actors around