I would like to know how to take a defined image (e.g. a tile) in the LOVE game engine and draw it with a transparency that may vary per-frame. Stencils seem to only work for completely hiding parts of an image; I need to make an entire tile translucent, and the degree of translucency needs to be able to vary during gameplay.

(purpose: I am messing around with a game idea that involves partial information during fog-of-war, represented by superimposing all tiles that might be somewhere based on what you currently know)


1 Answer 1


Just set the color to white-with-less-than-full alpha before drawing the image. For instance, this would draw your image at around 50% opacity:

love.graphics.setColor(255, 255, 255, 128)
love.graphics.draw(image, 0, 0)

The easiest way to work with this if you want to fade something in / out is to have a fractional multiplier value from 0 to 1 and set the alpha component to 255 * that, i.e.

love.graphics.setColor(255, 255, 255, 255 * someMultiplier)
  • \$\begingroup\$ setColor takes values in the range 0-1, so it should be love.graphics.setColor(1, 1, 1, 0.5) \$\endgroup\$
    – Jocelyn
    Commented Apr 1, 2020 at 18:31
  • \$\begingroup\$ That’s true as of version 11, which is newer than this answer. From the wiki: “In versions prior to 11.0, color component values were within the range of 0 to 255 instead of 0 to 1.” \$\endgroup\$ Commented Apr 6, 2020 at 23:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .