Help me on bordering without getting characters stuck?



I'm creating a game with two different minigames inside that have inverted controls, and one of them is closed to being finished while the other is, but I haven't bordered either. I would prefer it if both are bordered because the cars in one of them go through the screen to stop people from cheating and you can move, and I dislike things outside of the given area, excluding ideas.

But I don't want the character to get stuck or getting sent back to X 500, Y 100 by just being close or trying to go on a lilypad or log, and in the other game, I would like it to have free roam but not touch the outside and have the screen edge act like an iPad edge where you can't go any further and slide around on the edge.

The character in this game has it's X controlled by Y and Y controlled by X, which is the reason I didn't make the games fullscreen, as X goes up to 1024 while Y only about 800, and it bothers me when the other isn't the same for the screen.

I already have a rule when character is not touching the screen for cheating, but it doesn't apply to when the character is touching the outside. Do any of you have any ideas or functional ones for the edge screen and borders?

The unfinished game is here:


I would like ideas for these borders, one that would make it so that the character, when it touched outside the screen, would be sent back to it's original position, and another border that would be one where the character wouldn't get stuck on in the corners, and would be able to slide smoothly on the border. I'm not very experienced in borders, and I haven't seen anything helpful for borders like these on the forum.


There are two minigames, one which is randomized and like Crossy Road with controls for back, forward, left, right, but the controls' places are inverted. Another is a game where you avoid a dog and get food, and it's controlled with last touch y and last touch x, where your X is controlled with your last touch y and your y with last touch X.


make a border using a large capital I
For the left and right of screen.
When a character is touching the left I
Change x by 25
When touching the right I
Change x by -25

Make this number bigger or smaller to suit yourself.


But you can move anywhere with your finger, and in the game with this border you don't move back to a position.


Code when you touch the border set position to x? Y?

Make this position where you want to restart from

And make the character invisible when touches the border and visible after going to the set position


But there is no set position, it's why I wanted a sliding border for one of the games.