Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: Pause a lua script?

                  
   
  1. #1
    DCEmu Regular Anonymous D's Avatar
    Join Date
    Jul 2006
    Posts
    414
    Rep Power
    67

    Question 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.

  2. #2
    DCEmu Pro dangee's Avatar
    Join Date
    Feb 2007
    Posts
    531
    Rep Power
    65

    Default controls

    PHP Code:
    screen:flip();
    repeat until Controls.read()circle(); 
    repeat until not Controls.read()circle();
    screen:flip() 

  3. #3
    PSP Coder -Xandu-'s Avatar
    Join Date
    Jan 2007
    Posts
    1,036
    Rep Power
    79

    Default

    You can do like:

    while true do

    if not paused then
    GAME CODE
    elseif paused then
    DISPLAY PAUSE SCREEN (unpause here)
    end

  4. #4
    DCEmu Regular Anonymous D's Avatar
    Join Date
    Jul 2006
    Posts
    414
    Rep Power
    67

    Default

    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.

  5. #5
    DCEmu Pro dangee's Avatar
    Join Date
    Feb 2007
    Posts
    531
    Rep Power
    65

    Default

    k, replace the Controls lines with
    System.sleep(5000) --(5 sec pause)

  6. #6
    DCEmu Regular Anonymous D's Avatar
    Join Date
    Jul 2006
    Posts
    414
    Rep Power
    67

    Default

    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

  7. #7
    DCEmu Old Pro
    Join Date
    May 2006
    Posts
    1,073
    Rep Power
    71

    Default

    try
    screen.waitVblankStart(X)
    replace X with amount of time you want pause for

  8. #8
    DCEmu Regular Anonymous D's Avatar
    Join Date
    Jul 2006
    Posts
    414
    Rep Power
    67

    Default

    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

  9. #9
    DCEmu Pro dangee's Avatar
    Join Date
    Feb 2007
    Posts
    531
    Rep Power
    65

    Default 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..

  10. #10
    DCEmu Regular Anonymous D's Avatar
    Join Date
    Jul 2006
    Posts
    414
    Rep Power
    67

    Default

    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)

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •