How to make an actor stay within the bounds of an area?
raandm17
Member Posts: 8
Hey,
Just wanted to know how to make an actor stay within the bounds of a specific area. Let's say for example the screen size of any device?
Comments
This would constrain the actors X position between max scene width.
self.position.X to: max( scene.Camera.Size.Width /2- scene.Camera.Size.Width /2,min( scene.Camera.Size.Width /2+ scene.Camera.Size.Width /2, self.Position.X ))
You can also just use actors as walls and have player actor collide with them to keep in bounds.