Glimmr Canvas Animation

version 1/111030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Section: Delaying input until animations finish

    By default, animations will continue to run while other game functions are operating--the player will be free to continue typing commands and so on while animation in underway. Sometimes, though, we may want to pause the textual part of our game while an animation plays out. We can do this with one of two different commands:

        delay input until all animations are complete
        delay input until <track> is complete
        
    These phrases prevent the game from asking for commands from the player until either *all* animations have completed (the first phrase), or until a specific animation has completed (the second phrase).

    The best place to place a delay instruction is usually immediately after the "animate" lines it is associated with. For example:

        animate the walking track as a reel animation targeting the player-sprite at 8 fps, cycling;
        animate the waypoint movement track as a motion animation targeting the player-sprite and ending at {421, 242} at 8 fps with velocity of 10;
        delay input until all animations are complete;
        say "Done!".

    The game will pause immediately, and only code that fires due to animation, or to other timer events, will be run. The say phrase at the end of the block of code above will not print until the animation has completed.