You could do it in one event with clamp ;
8 direction is moving : Set position to x: clamp(sprite.X,0,854) y :clamp(sprite.Y,-480,480);
This assumes that the layout width is 854, and height is 480 & would bound the player to layout except the top. Allowing the player to leave the layout up to 480 px upwards.
Edit : Don't forget to account for the sprite width and height ;
x : clamp(sprite.X,0+sprite.Width/2,854-sprite.width/2)
y : clamp(sprite.Y,-480+sprite.Width/2,480-sprite.width/2)