Log In  


Well I am new to lua and pico-8

In javascript, it is possible to force run inner function after some seconds with setTimeout();

setTimeout(function(){},5000);

and I am looking for something similar method or function in lua or pico-8

this is my code

function define_level()
	local level = 'level'..levels;
	show_level(level);
end
function show_level(level)
	print(level,54,64,8);
end

levels is number.

I want to hide or remove text which is printed with print(level, 54,64,8);
after some seconds.

Any tips?



timer_limit=60
my_timer=0
if my_timer<timer_limit then
my_timer+=1
print(level,54,64,8)
end


arashi256// I understand what you are trying with if loop but removing text didn't work to me


arashi256// maybe if loop runs just once..?


It's not a loop, it's an if statement. Perhaps this will be clearer..

-- init section
timer_limit=60
my_timer=0
-- Then, in your game loop...
if my_timer<timer_limit then
my_timer+=1
print(level,54,64,8)
end

You need to clear the screen in your _draw function ((if you have one. If not, look at the samples/doc)



[Please log in to post a comment]