The object that needs to warp, I think the players?
EDIT: Or do you want to scroll the background accordingly to the player's direction?
view_xview += scroll_speed; // set horizontal viewspeed to scroll_speed which is is 2
with(obj_P1){
if view_xview > bbox_left{ // checks if objects hitbox is less than the view screen
if place_free(x + view_xview - bbox_left,y){
x += (1 + view_xview - bbox_left); // pushes object with screen so they don't disappear to the left
}
}
}
with(obj_P2){
if view_xview > bbox_left{ // same for player 2
if place_free(x + view_xview - bbox_left,y){
x += (1 + view_xview-bbox_left);
}
}
}
with(obj_P1)
{
if view_xview + view_wview < bbox_right // checks if objects hitbox is greater than the view screen
if place_free(x + view_xview + view_wview - bbox_right,y)
x += 1 + (view_xview + view_wview - bbox_right); // pushes object with screen so they don't disappear to the right
}
with(obj_P2)
{
if view_xview + view_wview < bbox_right // same as player 2
if place_free(x + view_xview + view_wview - bbox_right,y)
x += 1 + (view_xview + view_wview - bbox_right);
}
This code is responsible for the screen scrolling it is in an invisible "controller" object in the room which also holds the values for health, respawn etc...
This code is in its step event.