Help with constraining to a zone
Hi there,
I have an actor that I would either like to drag up and down or left and right. If I wanted the actor to only be able to be dragged up to a certain point and down to a certain point with with out the actor stopping and then being unable to be dragged at the end points, how would I do this?
Thanks
Best Answers
-
joshiwu Posts: 207
Incompass your drag rule in another rule that says "if mouse position < starting position+50 AND IF Mouse position > starting position - 50
Then constrain -
colander Posts: 1,610
@GamesforGood in your actor place a rule with two Constrain Attributes and change these example values to whatever you want.
Rule - Actor receives event : Touch is Pressed
self.PositionX to min(max( game.Mouse.Position.X ,100),400)
self.PositionY to min(max( game.Mouse.Position.Y ,100),200)
If you want to use an off set to stop the actor moving to your touch there is a tshirtbooth video on how to do that just do a search for it.
Answers
Thanks guys that worked!