Gotchas
Posted: Mon Feb 25, 2013 7:38 am
There seems to be some common problems people run into when using LOVE, and I was thinking maybe it would be cool to kind of collect them all in one place so people could read through them early in their LOVE-learning journey. I dunno. What do you think?
Here are some things I thought of:
Images are drawn an unexpected color?
With the default blend mode, images are affected by the current color, so putting love.graphics.setColor(255, 255, 255) before drawing the image should draw it with its original colors.
Canvases with transparency don't look right?
Screenshots don't look right/are transparent in places?
1 pixel lines/"line" mode rectangles/points look blurry?
Images look blurry?
Are they drawn at whole number coordinates, including the offset? math.floor can be used to remove the fractional part of a number.
The outside edges of Quads bleed into it?
Try creating a 1 pixel border around the Quad area with the same colour of the pixels inwardly adjacent to it.
Sources don't play again?
To play a Source which is already playing again: stop it, then play it again.
or
Also, Ogg Vorbis files are recommended over WAV files. You can convert to Ogg using Audacity.
.love file doesn't work?
Some graphics cards can't handle large images/canvases. [citation needed]
Removing a table entry from a numerically indexed table while looping through it?
Here are some things I thought of:
Images are drawn an unexpected color?
With the default blend mode, images are affected by the current color, so putting love.graphics.setColor(255, 255, 255) before drawing the image should draw it with its original colors.
Canvases with transparency don't look right?
Screenshots don't look right/are transparent in places?
1 pixel lines/"line" mode rectangles/points look blurry?
Images look blurry?
Are they drawn at whole number coordinates, including the offset? math.floor can be used to remove the fractional part of a number.
The outside edges of Quads bleed into it?
Try creating a 1 pixel border around the Quad area with the same colour of the pixels inwardly adjacent to it.
Sources don't play again?
To play a Source which is already playing again: stop it, then play it again.
Code: Select all
love.audio.stop(source)
love.audio.play(source)
Code: Select all
source:stop()
source:play()
.love file doesn't work?
- Is main.lua in the "top level" of the zip file, rather than in a folder in the zip file?
- Is the file a renamed .zip file, rather than a .rar file?
- Are the file paths in the correct case? For example, is "example.png" not refered to as something like "Example.PNG"?
Some graphics cards can't handle large images/canvases. [citation needed]
Removing a table entry from a numerically indexed table while looping through it?