enchant.js ゲームエンジン

HTML

<!DOCTYPE html>
<html>
   <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes"> 
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <title>enchant</title>
    <script type="text/javascript" src="build/enchant.js"></script>
    <script type="text/javascript" src="build/plugins/nineleap.enchant.js"></script>
    <script type="text/javascript" src="build/plugins/ui.enchant.js"></script>
    <script type="text/javascript" src="game.js"></script>
 </head>
 <body>
 </body>
</html>

Class

http://enchantjs.com/ja/resource-ja/overview/

http://wise9.github.io/enchant.js/doc/core/ja/symbols/enchant.Entity.html

// enchant.js Sprite
MySpriteName = Class.create(Sprite, 
{
   initialize:function()
   {
       Sprite.call(this, 32, 32);
       this.image = game.assets["code01.png"];
       this.x = 100;
       this.y = 100;
       game.rootScene.addChild(this);
   },
   onenterframe:function()
   {
       // CODE
   },
   ontouchmove:function(e)
   {
       // CODE
   },
   ontouchstart:function()
   {
       // CODE
   },
   ontouchend:function()
   {
       // CODE
   }
});
  • Sprite.x
  • Sprite.y
  • Sprite.frame
  • Sprite.age
  • Sprite.scale()
  • Sprite.scaleX
  • Sprite.scaleY

メイン処理

// メイン処理
window.onload = function()
{
   game = new Game(853, 640);
   game.fps = 8;
   
   game.preload("code01.png", "button02.png");
   
   game.onload = function()
   {
       var mySprite = MySpriteName();
       // game.rootScene.addChild(mySprite);
       
       var titleLabel = new Label("TEXT TEXT");
       game.rootScene.addChild(titleLabel);
   }
}
// スプライトを120度回転させる
sprite.rotate(120);

http://blog.livedoor.jp/kamikaze_cyclone/archives/34034075.html

http://blog.livedoor.jp/kamikaze_cyclone/archives/33931733.html

http://qiita.com/Yusuke_mori/items/87215c46426f60401c6b