topical media & game development

talk show tell print

mobile-graphic-enchant-examples-beginner-hellobear-nocomment-main.js / js



  enchant();
  
  window.onload = function(){
      var game = new Game(320, 320);
      game.fps = 15;
      game.preload("mobile-graphic-enchant-examples-beginner-hellobear-chara1.png");
      game.onload = function(){
          var bear = new Sprite(32, 32);
          bear.image = game.assets["mobile-graphic-enchant-examples-beginner-hellobear-chara1.png"];
          bear.x = 0;
          bear.y = 0;
          bear.frame = 5;
          game.rootScene.addChild(bear);
  
          bear.addEventListener("enterframe", function(){
              this.x += 1;
              this.frame = this.age % 2 + 6;
          });
  
          bear.addEventListener("touchstart", function(){
              game.rootScene.removeChild(bear);
          });
      };
      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.