Page 1 of 1

Unable to display text and images at the same time

Posted: Mon Dec 31, 2018 8:25 am
by Neox Hopper
When I enter this script into my game, it shows the image but it doesn't show the text. Does anyone know how to fix this issue?

Script:

function love.load()

potato = love.graphics.newImage("potato.png")
end

function love.draw()

love.graphics.draw(potato, 250, 250)
end

function love.draw()

love.graphics.print("Here's potato!")
end

Re: Unable to display text and images at the same time

Posted: Mon Dec 31, 2018 2:53 pm
by zorg
Hi and welcome to the forums;

The issue is that you can only have one love.draw defined, and since you're doing it twice, the second overwrites the first.

This fixes it:

Code: Select all

function love.load()
    potato = love.graphics.newImage("potato.png")
end
function love.draw()
    love.graphics.draw(potato, 250, 250)
    love.graphics.print("Here's potato!")
end

Re: Unable to display text and images at the same time

Posted: Mon Dec 31, 2018 10:13 pm
by Neox Hopper
Oh now I get it, thank you so much for the info :D