public Vector2 Repositionning(KinematicBody2D player) { if (player.Position.x >= player.GetViewportRect().Size.x) { return(new Vector2(0, player.Position.y)); } if (player.Position.x <= 0) { return(new Vector2(player.GetViewportRect().Size.x, player.Position.y)); } if (player.Position.y >= player.GetViewportRect().Size.y) { return(new Vector2(player.Position.x, 0)); } if (player.Position.y <= 0) { return(new Vector2(player.Position.x, player.GetViewportRect().Size.y)); } return(player.Position); }