PacMan Error

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Dieghito03

How can I make the palyer goes out from the window and then make it reappear from the other side like PacMan?`

:bust_in_silhouette: Reply From: kidscancode

You didn’t say anything about how you have your game set up, but generally speaking you can use the built-in wrapf() function:

var screen_size = get_viewport_rect().size
position.x = wrapf(position.x, 0, screen_size.x)