Setting a boundry

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
phantom
Prole
Posts: 2
Joined: Sun Nov 18, 2012 10:02 am

Setting a boundry

Post 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?
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: Setting a boundry

Post 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.
phantom
Prole
Posts: 2
Joined: Sun Nov 18, 2012 10:02 am

Re: Setting a boundry

Post by phantom »

I figured it out. Thanks anyways!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests