A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: PAUSE

  1. #1
    Senior Member random10122's Avatar
    Join Date
    Mar 2002
    Location
    Sheffield, UK
    Posts
    1,747
    Hello,

    Does anyone know how to pause a game, i.e. when the a button is pressed all animaion / action / mc's EVERYTHING is stopped until it is clicked again??? This would be real helpful,

    Cheers, Tom

  2. #2
    incredibulus-actionscriptum magnetos's Avatar
    Join Date
    May 2001
    Posts
    2,160
    well i am afraid there isn t an easy way
    you can try something like this

    onClipEvent(enterframe)
    {
    if (!_root.pause)
    {
    //here goes all the code
    }
    }
    this code will be on all mcs

    so when you press a button or a key you make
    pause=true and false accordingly


  3. #3
    Senior Member
    Join Date
    Feb 2001
    Posts
    314
    It depends entirely on the kind of game you develop and how you develop it. I have a pause button on one of my games ( http://www.frothworks.com/games/fruit.html ). It's a tetris type game (you press "P" to pause).

    In this game, all of the animation ActionScript is in frames on the main timeline. So pausing is as simple as sending the timeline to another frame on the main timeline--a frame that still has the graphics but not the ActionScript. Then when "R" (for resume) is pressed, the timeline is sent back to the previous frame and the action continues.

    Now, that's not going to work for all games. If you've got ActionScript attatched to movieclips, for instance, you're probably going to have to do something like what magnetos suggested.

    Good luck!

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center