I want to display an image for every state change that takes place. For instance when the player does something right, I might want to display 'Good Job!' on the screen. Currently this is what I have and it works, but the 'Good Job!' image just lasts for a second. I know this is something to do with the update callback but can somebody please tell me how to make the image appear for a little longer time on the screen?
Thanks!
function love.draw()
if (correct) then
love.graphics.setColor(255,255,255,255)
love.graphics.draw( image, goodjob_x, goodjob_y)
correct = false
end
end
timer = 0
target = 5 --The time in seconds you want to display the image.
correct = true
function love.update(dt)
timer = timer + dt
end
function love.draw()
if correct and timer <= 5 then
love.graphics.setColor(255,255,255,255)
love.graphics.draw( image, goodjob_x, goodjob_y)
else
timer = 0
correct = false
end
end