x+=(view.width+width) * ((x>view.x+view.width) - (x<view.x));
skydereign wrote:You can add this event to the player.
player -> Out of Vision -> Script Editor
- Code: Select all
x+=(view.width+width) * ((x>view.x+view.width) - (x<view.x));
What it does is move the player by the view's width plus the actor's width forward or backward when it leaves the view. That way it will appear to the right or left of the view. The (x>view.x+view.width)-(x<view.x) part returns a 1 or -1 during an out of vision event, and that is used to determine which direction the actor needs to move in.
x-=(view.width+width) * ((x>view.x+view.width) - (x<view.x));
((x>view.x+view.width) - (x<view.x));
// that's pretty much saying (to the right of the screen) - (to the left of the screen)
Users browsing this forum: No registered users and 1 guest