i want to print a text with a black color but if i want to restore the colors for the sprites(to keep the original colors) how i can do this with love.graphics.setColor(r,g,b,a)???
function love.draw()
love.graphics.setColor(0,0,0,100)
love.graphics.setFont(mainFont) -- select the main font
love.graphics.print("Score: " .. tostring(score), _WIDTH, _HEIGHT) -- print score and
love.graphics.print("Lives: " .. tostring(lives), _WIDTH, _HEIGHT + (64)) -- lives on the screen
--HOW I CAN RESTORE THE COLORS FOR THE SPRITES.
--Draw stuff
love.graphics.draw(bg.img, 0, 0);
for i,bullet in ipairs(bullets) do
love.graphics.draw(bullet.img,bullet.x,bullet.y)
end
for i, enemy in ipairs(enemies) do
love.graphics.draw(enemy.img,enemy.x,enemy.y)
end
if isAlive then
love.graphics.draw(player.img, player.x - (player.w / 2), player.y - (player.h / 2) )
end
end
function love.draw()
love.graphics.push( 'all' )
love.graphics.setColor(0,0,0,100)
love.graphics.setFont(mainFont) -- select the main font
love.graphics.print("Score: " .. tostring(score), _WIDTH, _HEIGHT) -- print score and
love.graphics.print("Lives: " .. tostring(lives), _WIDTH, _HEIGHT + (64)) -- lives on the screen
love.graphics.pop()
--Draw stuff
love.graphics.draw(bg.img, 0, 0);
-- etc. ...
end
Also, it's probably not drawing the text because you're drawing bg.img over the text- try reversing the order and see what happens.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim