topical media & game development

talk show tell print

mobile-graphic-enchant-tests-feature-group-rotation-main.js / js



  
グループの回転。

  
  
  enchant();
  window.onload = function() {
      var game = new Game(320, 320);
      game.preload('mobile-graphic-enchant-tests-feature-group-rotation-chara1.png');
      game.onload = function() {
          var bear = new Sprite(32, 32);
          bear.image = game.assets['mobile-graphic-enchant-tests-feature-group-rotation-chara1.png'];
          bear.frame = 1;
          bear.x = 0;
  
          var white = new Sprite(32, 32);
          white.image = game.assets['mobile-graphic-enchant-tests-feature-group-rotation-chara1.png'];
          white.x = 32;
          white.y = 32;
          white.frame = 5;
  
          var group = new enchant.Group();
          group.addChild(bear);
          group.addChild(white);
          group.originX = 32;
          group.originY = 32;
  
          game.rootScene.addChild(group);
          group.on('enterframe', function() {
              this.rotation += 2;
              this.x += 1;
              this.y += 1;
          });
      };
      game._debug = true;
      game.start();
  };


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.