Something like this(note: not actually code, but easy to understand):
+ = conditions
FIRST LAYOUT:
+ Character reaches left of screen
- Set global variable 'yposition' to character.Y
- Set global variable 'side' to "left"
SECOND LAYOUT:
+ On Start of Layout
+ If global variable 'side' is equal to "left"
- Set character.X to 640
- Set character.Y to global('yposition')
+ If global variable 'side' is equal to "right"
- Set character.X to 0
- Set character.Y to global('yposition')
If you want, I could probably rig up an example file pretty quickly. Hope that helps.