I'm trying to make blinking text. To display Insert coin and have it appear and vanish every 2 seconds.
I cannot find any tutorials for this, or documentation describing a method for this.
simple, establish with a window, draw text, start a timer, pause the timer, update. but I'm not sure why it's failing. If I run without start_timer, draws the text fine. if I run with start_timer, no text is drawn.
Have I made some simple mistake in my logic?
I cannot find any tutorials for this, or documentation describing a method for this.
Code:
class Window_Flash_Start < Window_Base
def initialize(x,y,w,h)
super
contents.font.size = 42
$show_text = true
#start_timer
draw_content
end
def draw_content
draw_text(0,0,"Insert Coin".length * 42,48,"Insert Coin", 1) if $show_text
end
def start_timer
i = 0
for i in 0...Graphics.frame_rate * 20
if i < Graphics.frame_rate * 2 then
$show_text = true
else
$show_text = false
end
break if Input.trigger?(11)
end
pause_start if $show_text == true
end
def pause_start
i = 0
for i in 0...Graphics.frame_rate * 2
end
update
end
def update
$Graphics.update
start_timer
end
end
simple, establish with a window, draw text, start a timer, pause the timer, update. but I'm not sure why it's failing. If I run without start_timer, draws the text fine. if I run with start_timer, no text is drawn.
Have I made some simple mistake in my logic?