Page 1 of 1

Setting a boundry

Posted: Sun Nov 18, 2012 10:05 am
by phantom
Hi, I am EXTREMELY new to love2D.

I have been watching tutorials, I have a neat game in development. But one thing that is a MUST in this development process is the prevention of the game character from walking off screen.

Is there any possible way to set a boundry on set sides of my game window?

Re: Setting a boundry

Posted: Sun Nov 18, 2012 10:28 am
by T-Bone
Yes, just don't let it walk outside. So whenever you want to move your character, first calculate the next x and y coordinates that the character would have after the movement, then check that those coordinates are within the window, and if so, do the movement.

Re: Setting a boundry

Posted: Sun Nov 18, 2012 11:21 am
by phantom
I figured it out. Thanks anyways!