I think it depends on how you're set up but this works for me:
if self.position.x > 200 constrain attribute self.position.x = 200
...for each of the 4 borders. if you need it to depend on the starting position you could use a starting point attribute, then use +/-50y or +/-100x to constrain dynamically.
Comments
if self.position.x > 200
constrain attribute self.position.x = 200
...for each of the 4 borders. if you need it to depend on the starting position you could use a starting point attribute, then use +/-50y or +/-100x to constrain dynamically.