How do I set multiple colors? Help please.
Posted: Sat Aug 25, 2012 11:28 pm
I was wondering if it is possible to set 2 colors for something. I use love.graphics.setColor(r, g, b) to set a color for something (I'm not even sure if theres another way), but you cant set 2 different colors, it's either one or none. Does anyone know if theres a way to set a color for a specfific object and not everything?
Here's my code, it may help you understand what I'm asking help on. In my code, you will see one lua.graphics.setColor, I want the second one to be under the finish1_draw() function, so all the "walls" will be 158, 158, 158 (gray), and the finishline will be a different color.
My code:
(I have more code for the game that I'm working on, but I dont think it really matters, because I'm just focusing on the colors)
Here's my code, it may help you understand what I'm asking help on. In my code, you will see one lua.graphics.setColor, I want the second one to be under the finish1_draw() function, so all the "walls" will be 158, 158, 158 (gray), and the finishline will be a different color.
My code:
Code: Select all
finishline = love.graphics.newImage("Images/finish.png")
function level1_draw()
love.graphics.rectangle("fill", 410, 150, 40, 350) --Left Wall
love.graphics.rectangle("fill", 490, 150, 40, 350) --Right Wall
love.graphics.rectangle("fill", 410, 150, 120, 40) --Top Wall
love.graphics.rectangle("fill", 410, 500, 120, 40) --Bottom Wall
love.graphics.setColor(158, 158, 158)
if player.x < 451 or
player.x > 465 or
player.y < 191 or
player.y > 474 then
player.x = startPosX
player.y = startPosY
end
function finish1_draw()
love.graphics.draw(finishline, 458, 200)
end
end