Page 1 of 1

i am looking for an example to make a text blink

Posted: Sun Aug 12, 2018 8:02 pm
by Bernard51
Hello

I am looking for an example to make a text blink thanks in advance

Re: i am looking for an example to make a text blink

Posted: Sun Aug 12, 2018 8:10 pm
by zorg
use a timer, if some time elapsed, flip a boolean variable; if it's false, do nothing (or draw your text in the "off" state, different color or whatever), if it's true, draw your text "normally".

Re: i am looking for an example to make a text blink

Posted: Sun Aug 12, 2018 8:27 pm
by Bernard51
sorry i did not understand anything

Re: i am looking for an example to make a text blink

Posted: Sun Aug 12, 2018 9:30 pm
by steVeRoll
I guess you could do something like this:

Code: Select all

function love.draw()
  if math.floor(love.timer.getTime()) % 2 == 0 then
    love.graphics.print("Your text here")
  end
end

Re: i am looking for an example to make a text blink

Posted: Mon Aug 13, 2018 5:11 am
by Bernard51
Thank you steVeRoll