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:

This will make you a better decision maker | Annie Duke (author of “Thinking in Bets” and “Quit”, former pro poker…

Annie is a former professional poker player, decision-making expert, author, and special partner at First Round Capital.  ͏     ­͏     ­͏   ...

Contact Form

Name

Email *

Message *