# Room Boundaries

5 replies to this topic

### #1 V1ceC1ty

V1ceC1ty

GMC Member

• New Member
• 10 posts

Posted 08 August 2009 - 06:33 AM

How can i set room boundaries instead of using objects to block the player from getting out?
• 0

### #2 Cup of Joe

Cup of Joe

GMC Member

• New Member
• 71 posts

Posted 08 August 2009 - 06:48 AM

In the player object's step event, put something that's like

if(x>room_width-sprite_width){x=room_width-sprite_width;}
if(x<0){x=0;}

• 0

### #3 ~Dannyboy~

~Dannyboy~

~hoqhuue(|~

• GMC Member
• 2144 posts
• Version:GM8

Posted 08 August 2009 - 07:48 AM

Best put that in the end-step event.

You could also use "x = xprevious; y = yprevious;" in the intersect boundary event.
• 0

### #4 V1ceC1ty

V1ceC1ty

GMC Member

• New Member
• 10 posts

Posted 08 August 2009 - 08:02 AM

that would be on the 1st room the object starts in wouldnt it? how would i do it for a certain room?
• 0

### #5 TheSnidr

TheSnidr

That guy

• Global Moderators
• 2471 posts
• Version:GM:Studio

Posted 08 August 2009 - 09:10 AM

that would be on the 1st room the object starts in wouldnt it? how would i do it for a certain room?

```if room=certain_room
{
if x>room_width
{
x=room_width
}
if x<0
{
x=0
}
}```

Edited by TheSnidr, 08 August 2009 - 09:10 AM.

• 0

Whiz Kid

• GMC Member
• 2744 posts

Posted 08 August 2009 - 09:15 AM

that would be on the 1st room the object starts in wouldnt it? how would i do it for a certain room?

It doesn't matter which room it is. It will work for every room.
• 0

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users