For those of you who are interested, I’ve written a LOVE sample that demonstrates how to perform per pixel collision between two PNG images. It basically examines the PNG image’s transparent pixels and creates a collision map which can be used later to test for the collision of two non-transparent pixels. It’s definitely slower than doing a basic bounding box collision check but necessary if you want to check something like an image of the player’s ship against a much larger image of some terrain.
If I’ve misused the LOVE engine/framework in any way please let me know. I’m evaluating LOVE for use in a university course and I’m very interested in writing samples and demos that use it correctly.
I tried uploading the file via the forum but it garbles it on download, so here's a plain 'ol link:
You may have to do a right-click and "Save As Link..." to get it.
Well, I guess I should clarify what I mean by "misuse". What I mean is , if I'm not using LOVE in the best possible way or if I'm implementing something which LOVE can already do, but I'm unaware of, please let me know.
While I'm on the subject, am I correct in my understanding that LOVE no longer supports an animated image loader in 0.6.2? Older samples seem to make use of a newAnimation() function to load image files that contains multiple sub-images.
Correct, in 0.6.0 animations were removed, in order to provide legacy support I created a replacement library mimicing the API, it's called Animations And Love (AnAL), it has its own wiki page.
I guess there was a reason for its removal, but removing animation support seems like going backwards since animated sprites are such a basic concept in 2D engines. Also, the explicit sexual reference will prevent me from using that library it in a graduate level course. I'll just have to roll my own and add it directly to the course's starter game. Not a huge deal.
Yojimbo wrote:I guess there was a reason for its removal, but removing animation support seems like going backwards since animated sprites are such a basic concept in 2D engines.
Well, animations are actually much more powerful in 0.6.* than before. They are not called Animations anymore, but Quads, because they can do much more than animating.
Yojimbo wrote:Also, the explicit sexual reference will prevent me from using that library it in a graduate level course.
Heh. Bartbes and his... professional project naming scheme.
Your image named terrain.png has extents that are not powers of two. This means it won't display properly for some people. It is considered good manners to use images that have power of two extents, because of this limitation stemming from the capabilities of some graphics cards. There's also a helpful tool around here somewhere that will pad your images automatically. Whose was it again? Robin's?
As a clarification, the x and y sizes need not be the same, both just have to be some power of two. And the issue affects only some computers, cards and driver versions. It comes down to whether the particular OpenGL implementation supports non-POT textures or not.