script.js 753 B

1234567891011121314151617181920212223242526272829303132
  1. var stage, controller;
  2. function init() {
  3. // Do not use this for now...
  4. // createjs.MotionGuidePlugin.install();
  5. controller = new Controller;
  6. resize();
  7. controller.start_game();
  8. var p2 = new Particle({x: 10, y: 10});
  9. p2.start_time = createjs.Ticker.getTime();
  10. p2.target = {
  11. time: p2.start_time + 1000,
  12. x: 12,
  13. y: 15
  14. }
  15. var p2v = new ParticleView(p2);
  16. controller.add_view(p2v);
  17. }
  18. function resize() {
  19. var height = window.innerHeight;
  20. var width = window.innerWidth;
  21. window.cell_size = height > width ?
  22. height / controller.grid_size.y :
  23. width / controller.grid_size.x;
  24. controller.stage.canvas.width = width;
  25. controller.stage.canvas.height = height;
  26. }