Coloring Text Without Coloring Sprites

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
MichaelShort
Prole
Posts: 14
Joined: Mon Sep 28, 2015 3:28 pm

Coloring Text Without Coloring Sprites

Post 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)
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Coloring Text Without Coloring Sprites

Post 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.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
MichaelShort
Prole
Posts: 14
Joined: Mon Sep 28, 2015 3:28 pm

Re: Coloring Text Without Coloring Sprites

Post 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.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 2 guests