Log In  

I tried using flip() but it was a very small delay. I dont want to use time() because doing it that way is very complicated. Is there any other way to make a pause.

\132 is the scattered dot emoji. \129 is the checkerboard emoji. \128 is the horiz rectangle emoji.\146 is the star emoji. I want a pause between every cycle of the for loop

this is my code:

for i=1,4 do
 if (i==1) then
  print("\132\132\132 \132\132\132",36,63,7)
 end
 if (i==2) then
  print("\129\129\129 \129\129\129",36,63,7)
 end
 if (i==3) then
  print("\128\128\128 \128\128\128",36,63,7)
 end
 if (i==4) then
  print("\146game over\146",36,63,7)
 end
end
P#138283 2023-12-05 16:57

1
function wait(seconds)
   local i
   for i=1,seconds*30 do
      flip()
   end
end

Example : wait a quarter of a second :
wait(0.25)

P#138287 2023-12-05 17:29 ( Edited 2023-12-05 17:29)

using time() isn't so bad..

--setup
if (something) startTime = time() + optionalDelay

.....
--check (on update)
local now = time()
if ((now >= startTime) && (now < startTime + 1)) then
 --do phase one
elseif ((now >= startTime + 1) && (now < startTime + 2)) then
 --do phase two
elseif ((now >= startTime + 2) && (now < startTime + 3)) then
 --do phase three
elseif ((now >= startTime + 3) && (now < startTime + 4)) then
 --do phase four
end

*not tested

Put this all inside some kind of if (dead) check to run during Game Over conditions

P#138290 2023-12-05 17:46

@RealShadowCaster Thanks so much! Helped alot

P#138292 2023-12-05 18:10

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-02-23 16:09:39 | 0.040s | Q:12