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
Unable to display text and images at the same time
-
- Prole
- Posts: 8
- Joined: Mon Dec 31, 2018 8:20 am
- zorg
- Party member
- Posts: 3465
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Unable to display text and images at the same time
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:
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
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
-
- Prole
- Posts: 8
- Joined: Mon Dec 31, 2018 8:20 am
Re: Unable to display text and images at the same time
Oh now I get it, thank you so much for the info
Who is online
Users browsing this forum: Ahrefs [Bot] and 2 guests