-
Pause a lua script?
is it possible to make a lua script pause for a certain amount of time e.g :
(hitest player with enemy)
if hitest (true) then
draw image 1
pause
draw image 2
pause
draw image 3
end
(with proper syntax of course) . just im trying to show a ship exploding but just blitting all the images in a row only takes a few milleseconds so you dont actually see anything.
-
controls
PHP Code:
screen:flip();
repeat until Controls.read()circle();
repeat until not Controls.read()circle();
screen:flip()
-
You can do like:
while true do
if not paused then
GAME CODE
elseif paused then
DISPLAY PAUSE SCREEN (unpause here)
end
-
thanks in a way..i dontt hink i explained very well. basically what i want is to display a sprite sequence but with a pause in between each image (otherwise you dont see them). and i want it to be sort off automatic rather than awating input from the player.
-
k, replace the Controls lines with
System.sleep(5000) --(5 sec pause)
-
will do thanks dangee...trying now....
edit: that seems to just stop the script for ever, its what i want but its to permenant lol
sos i misunderstood you ig et what you mean now
edit could you show me how youd use it with an image draw..
basically write it out with a blank blit in the right position
-
try
screen.waitVblankStart(X)
replace X with amount of time you want pause for
-
that has got me closets to my goal thanks very much.
thanks people, ive got it working now, apart from some strange bug which makes evertrything but the animation sprites move back and forward....but ill try and disguise it with an explosion sound and call it an effect lol i am making a shump after all
edit: also how wud i have 2 sounds play at once.. e.g sound effects along with sound music, ive tried it before with the normal sound things and one always seems to stop the other eventually if not immediatley
-
just being 'flip'?
dont give up on this one.the small details in the
GFX can make a big diff.(re:wunmorgo).
The sprites r dancing to & fro coz after the pause ur
flipping back to the previous screen.I thought the pause was
just for debug reasons. What you can do for each frame of the
animation is:
for i = 1 to numberOfAframes do
-- draw frame(i) to screen 1
-- flip
-- draw frame(i) to screen 2
-- flip
-- pause
end
*EDIT*..or just
-- draw frame(i)
-- flip
-- pause
should do it..
-
well basically ive got:
(hitest with enemy and other stuff in if loop) then
(reset enemy position back to original (off screeen))
screen:blit(Player[1].x,Player[1].y, player2)
screen:flip();
screen.waitVblankStart(1)
and so on till frame 7 of the explosion anim. player 1 is already drawn because that is the default image for the player ( a ship in this case)