Page 1 of 1

Coloring Text Without Coloring Sprites

Posted: Thu Oct 08, 2015 3:46 pm
by MichaelShort
So below we are coloring text. It also colors sprites with it though like are frog that we are making. How would we make it only color the text. Thanks in advance!

Code: Select all

love.graphics.setColor(0, 191, 255)
love.graphics.setFont(love.graphics.newFont(20))
love.graphics.print("hey", 100, 100)

Re: Coloring Text Without Coloring Sprites

Posted: Thu Oct 08, 2015 3:48 pm
by Nixola
First, you shouldn't be creating the font in love.draw, which you are doing. Create a table named fonts and put fonts in it, or something like that; just use a variable named "font20" if you wish, but you should only create new fonts (or new anything) once.
You can do what you're asking by setting the color back to white before drawing the image.
EDIT: two minutes delay! That's got to be my best time yet.

Re: Coloring Text Without Coloring Sprites

Posted: Thu Oct 08, 2015 3:54 pm
by MichaelShort
Nixola wrote:First, you shouldn't be creating the font in love.draw, which you are doing. Create a table named fonts and put fonts in it, or something like that; just use a variable named "font20" if you wish, but you should only create new fonts (or new anything) once.
You can do what you're asking by setting the color back to white before drawing the image.
EDIT: two minutes delay! That's got to be my best time yet.
Thank you! Don't know why I didn't try that or think of it.