Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics

Love2D beginner- why are Shape colors being applied images?

A topic by hyperking created Feb 03, 2017 Views: 1,055 Replies: 3
Viewing posts 1 to 3
(1 edit)

Hello, I have an issue where my game is applying the last shape color to my jpg image.

My game loads a background image and then loads a table of shape objects. Each shape object has a different color which appears correctly. However, when the game opens the last shape color is applied to the image.

Here is my main lua code

function love.load()
-- load game, 255, 255, 255), 255, 255, 255)
vader =,"vader.jpg"))
-- load players
loadPlayers = Player:loadPlayers(Levels[1].shapes)
function love.draw (),world.centerX /2,0,0,0.4,0.4 )

The Player:drawAll() method is looping all shapes and drawing them to the page using these lines., x, y,width, height)

You'll need to reset the color to white immediately above the call to draw vader. It's keeping the color from the end of the previous frame when drawing the image on the next.


Thanks @leafo. I realized this after looking at other examples.

A bit counter intuitive for this behavior to take place. I've set a default color at the end of my draw function so it works now.

In general, everything that you draw should be responsible for setting its own global state - shaders, colors, filter modes, etc.

Admin moved this topic to General Development