CAAT – Tutorial 5, Paths

Refer to the new tutorials and demos page too:
CAAT tutorials and demos.

This entry was posted in Sin categoría. Bookmark the permalink.
  • Maktech07

    I have been using your framework to get a simple game together with splash screens, main menu, in game loop, and was just implementing a pause button. I will most likely manage the pause menu as its own scene in the future, but in the mean time I wanted to pause the current scene. I implemented a pause flag on the actor and made the time = 0.0 before animating each actor if it was paused. I don’t feel this is right approach. Is there an easier way? Everything stopped rendering instead so it wasn’t the outcome I was looking for.
    Thanks,Matt

    • Anónimo

      Hi Matt,

      there’s no such method to pause animations right now.
      Animations pauses on scene change but not for some concrete actors. will have to add a method setPause(boolean) on director which pauses the whole current scene.
      It won’t be able to do it automatically for independent actors, since that would require to control virtual timelines for each on screen element and its related behaviors.
      You should never touch the actor time attribute since it is automatically managed for CAAT fore for instance to know whether the actor should be animated, painted, how to properly set behavior result values, etc. So instead of modifying the time parameter, it is better to honor the time parameter on the paint method. I consider modyfying the time not a good practice.
      If per scene pause is right for you, will add the method asap so that you could download the repo again.
      In the meantime, could you please tell me how you’d like pause to be implemented :) ?
      Thanks for your interest.
      Regards,
      -i

      • Maktech07

        Just like you specified, a setPause(boolean) function on the director to pause the current scene is great. Adding an accessor isPaused on the director would be helpful too. 
        To confirm this would leave the actors on screen rendered in their current location and state but, just not moving until the scene is unpaused, correct?Thanks for your quick response.
        Matt

        • Anónimo

          Hey Maktech07,

          I’ve added methods for pause management.
          You can call scene.setPaused( bool ) and check with scene.isPaused().
          With pause enabled, time is freezed for every on-screen actor, but in example buttons still react to input events.
          Download from github or get the minified caat version here:
          https://github.com/hyperandroid/CAAT/blob/master/build/caat.js

          Regards,
          -ibon

          • Maktech07

            Works great. Really appreciate the help. Have used Javascript at a basic level for years but never dove deep into the language. Your framework and others in the community have really shown me what I have been missing when it comes to what Javascript can really do. Thanks again,
            Matt