Sorry about this guys, but this has been trouble for a while

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
tommyroyall
Prole
Posts: 14
Joined: Fri Nov 02, 2012 12:47 am

Sorry about this guys, but this has been trouble for a while

Post by tommyroyall »

Hey again, sorry for 2 error posts in a night (please alarm me if there's a better place to go for help, I'm quite a newbie here in the community :)), but lets say that I used love.graphics.setColor(blah) and then did something, but then attempted to draw a sprite or do something without wanting any color effects, how would I go about doing that?
Santos
Party member
Posts: 384
Joined: Sat Oct 22, 2011 7:37 am

Re: Sorry about this guys, but this has been trouble for a w

Post by Santos »

Hi! :)

One way to do it would be to change the color to white before drawing the next thing:

Code: Select all

love.graphics.setColor(255, 0, 0)
love.graphics.circle('fill', 200, 200, 50) -- A red circle
love.graphics.setColor(255, 255, 255)
love.graphics.draw(sprite, 10, 10)
Another way to do it would be to change the color mode. The way color affects what is drawn can be changed using love.graphics.setColorMode (the different color modes are here: ColorMode)

By default, the color mode is "modulate". Changing it to "replace" will make what you draw afterwards unaffected by the current color.

Code: Select all

love.graphics.setColorMode('modulate')
love.graphics.setColor(255, 0, 0)
love.graphics.circle('fill', 200, 200, 50) -- A red circle
love.graphics.setColorMode('replace')
love.graphics.draw(sprite, 10, 10)
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests