Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. ;(function(game, cjs){
  2. game.start = function() {
  3. cjs.EventDispatcher.initialize(game); // allow the game object
  4. to listen and dispatch custom events.
  5.  
  6. game.canvas = document.getElementById('canvas');
  7.  
  8. game.stage = new cjs.Stage(game.canvas);
  9.  
  10. cjs.Ticker.setFPS(60);
  11. cjs.Ticker.addEventListener('tick', game.stage); // add game.
  12. stage to ticker make the stage.update call automatically.
  13. cjs.Ticker.addEventListener('tick', game.tick); // gameloop
  14.  
  15. game.physics.createWorld();
  16. game.physics.showDebugDraw();
  17. };
  18.  
  19. game.tick = function(){
  20. if (cjs.Ticker.getPaused()) { return; } // run when not paused
  21.  
  22. game.physics.update();
  23.  
  24. };
  25.  
  26. game.start();
  27. }).call(this, game, createjs);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement