Restrict Rectangle Movement
Posted: Wed Dec 07, 2011 12:07 am
Hey, I'm really new to LOVE and I just don't know how to restrict a simple key-controlled rectangle to the screen. I don't want it to pass the edges of the screen. There has to be an unbelievably simple way of doing this, but I couldn't find it in the API or the forums. Maybe I wasn't looking in the right place.
The other thing I need to do is restrict the rectangle from moving past the edges of other objects. I read on the API that you can do a lot without love.physics and so I'd like to be able to this without it if possible.
Basically my end goal here is a simple prototype of a square cursor moving through a maze made up of other rectangles, but with anything I draw, the square just keeps passing through the edges of any other shape. I just need to limit it to only being able to move in the empty areas of the screen.
Thanks so much!
The other thing I need to do is restrict the rectangle from moving past the edges of other objects. I read on the API that you can do a lot without love.physics and so I'd like to be able to this without it if possible.
Basically my end goal here is a simple prototype of a square cursor moving through a maze made up of other rectangles, but with anything I draw, the square just keeps passing through the edges of any other shape. I just need to limit it to only being able to move in the empty areas of the screen.
Thanks so much!