I've been trying to get this to work for so long, and I almost did but for some reason every time I run it only the picture shows up and not the text. When I put the code for the image in a comment, the text shows up, but when I un-comment the image code the text disappears and only the image shows. here's my code:
function love.draw()
love.graphics.print("Welcome to the game!", 0, 0)
end
local dog = love.graphics.newImage('dog.png')
function love.load()
love.graphics.setDefaultFilter('nearest', 'nearest')
end
function love.draw()
love.graphics.draw(dog, 300, 400)
end
Won't display text and image
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: Won't display text and image
You can't have two love.draw functions. The latter replaces the previous one. Put all your rendering code in the same function.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
"If each mistake being made is a new one, then progress is being made."
Re: Won't display text and image
As ReFrezzed mentioned, put your drawable in single love.draw function.
Like here:
Like here:
Code: Select all
local dog = love.graphics.newImage('dog.png')
function love.load()
love.graphics.setDefaultFilter('nearest', 'nearest')
end
function love.draw()
love.graphics.draw(dog, 300, 400)
love.graphics.print("Welcome to the game!", 0, 0)
end
-
- Prole
- Posts: 2
- Joined: Thu Jun 30, 2022 5:22 am
Re: Won't display text and image
Thank you so much! The text and picture are both displaying now!
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot], Semrush [Bot] and 2 guests