Thanks for the response @tshirtbooth but i don't want to use a collidable actor because the actor is constrained to the mouse x and y position so it wont collide with the collidable area anyway. the dead zone is located around another actor (the end of the level actor) and i don't want other objects to be able to go through to the area around the end of the level.
tatiangMember, Sous Chef, PRO, Senior Sous-ChefPosts: 11,949
edited March 2012
I'm thinking you could use magnitude to restrict the constrain behavior so that when your player actor is less than or equal to a certain distance from the end of level actor, the player actor is no longer constrained to the mouse x,y. I'll see if I can get this to work...
I can get the player actor to stop moving (e.g. if the condition is that DistanceToLevelEndActor>150 and touch is pressed then constrain to mouse x,y) but I can't start moving it again because the condition is then false (e.g. DistanceToLevelEndActor is 145). Maybe someone else will have an idea.
since its constraing to the mouse, you can make an attribute called constrainOff (boolean) and have it set to false. Then wherever you want to not be able to get to, have an invisible actor there and have a rule when mouse position is inside change attribute constrainOff to true, otherwise change constrain off to false
then in the actor thats constrained to the mouse, have the constrain behaviors in a rule when attribute constrainOff is false
tatiangMember, Sous Chef, PRO, Senior Sous-ChefPosts: 11,949
I also tried to keep track of LastValidX and LastValidY positions right before the player actor crosses the line (e.g. in my example above, going from 151 distance to 149 distance) and then doing a change attribute self.position.X to LastValidX, but alas that didn't work either.
Comments
I can get the player actor to stop moving (e.g. if the condition is that DistanceToLevelEndActor>150 and touch is pressed then constrain to mouse x,y) but I can't start moving it again because the condition is then false (e.g. DistanceToLevelEndActor is 145). Maybe someone else will have an idea.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
then in the actor thats constrained to the mouse, have the constrain behaviors in a rule when attribute constrainOff is false
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Well, for what it's worth, I came up with something that works for the most part, but it requires re-spawning the player actor: http://dl.dropbox.com/u/19602014/KeepAwayArea.zip
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User