GAMEMAKER ROOM WRAPPING

OBJ_PLAYER

STEP EVENT:


///keyboard movement
if (keyboard_check(ord('A')))  {x-=5;}
if (keyboard_check(ord('D')))  {x+=5;}
if (keyboard_check(ord('W')))  {y-=5;}
if (keyboard_check(ord('S')))  {y+=5;}
if x>room_width+1 //if off edge of room right
{
    x=1; //move to other side
}
if x<-1  //if off edge of room left
{
    x=room_width-1; //move to other side
}
if y>room_height+1 //if off edge of room bottom
{
    y=1; //move to other side
}
if y<-1 //if off edge of room top
{
    y=room_height-1; //move to other side
}

No comments:

When Bad People Make Good Art

I offer six guidelines on cancel culture ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏...

Contact Form

Name

Email *

Message *