게임메이커 채널

if bbox_left<0 and hspeed<0 

 hspeed=-hspeed

if bbox_right>room_width and hspeed>0 

 hspeed=-hspeed

if bbox_top<0 and vspeed<0  

 vspeed=-vspeed 

if bbox_bottom>room_height and vspeed>0 

 vspeed=-vspeed

while bbox_left<0

 x++

while bbox_right>room_width

 x--

while bbox_top<0

 y++

while bbox_bottom>room_height

 y--

 

 

 

 

 

스텝 이벤트에 넣으시면 작동합니다.

 

룸 밖으로 나가지 않게만 해주는 것이므로 튕겨서 다른곳으로 가게 하려면 다른 코드가 필요해요...