コード置き場

この記事は約 6 分で読めます。

P9

// code.9leap.net default template
// based on enchant.js v0.7.1
enchant();

window.onload = function(){
    var game = new Core(320, 320);
    game.fps = 30;
    game.preload("chara1.png");
    game.onload = function(){
        
        bear = new Sprite(32, 32);
        bear.image = game.assets["chara1.png"];
        game.rootScene.addChild(bear);
    };
    game.start();
};

P10

// code.9leap.net default template
// based on enchant.js v0.7.1
enchant();

window.onload = function(){
    var game = new Core(320, 320);
    game.fps = 30;
    game.preload("chara1.png");
    game.onload = function(){

        bear = new Sprite(32, 32);
        bear.image = game.assets["chara1.png"];
        bear.frame = 5;
        game.rootScene.addChild(bear);
    };
    game.start();
};   

 

P12

// code.9leap.net default template
// based on enchant.js v0.7.1
enchant();

window.onload = function(){
    var game = new Core(320, 320);
    game.fps = 30;
    game.preload("chara1.png");
    game.onload = function(){

        bear = new Sprite(32, 32);
        bear.image = game.assets["chara1.png"];
        bear.frame = 5;
				bear.x = 0;
				bear.y = 100;
        game.rootScene.addChild(bear);

    };
    game.start();
};   

 

P14

// code.9leap.net default template
// based on enchant.js v0.7.1
enchant();

window.onload = function(){
    var game = new Core(320, 320);
    game.fps = 30;
    game.preload("chara1.png");
    game.onload = function(){

        bear = new Sprite(32, 32);
        bear.image = game.assets["chara1.png"];
        bear.frame = 5;
				bear.x = 0;
				bear.y = 100;
        game.rootScene.addChild(bear);
				
         bear.addEventListener('enterframe', function() {
        				this.x += 1;
         });
    };
    game.start();
};   

 

P15

enchant();

window.onload = function(){
    var game = new Core(320, 320);
    game.fps = 15;
    game.preload("chara1.png");
    game.onload = function(){
    
        bear = new Sprite(32, 32);
        bear.image = game.assets["chara1.png"];
        bear.frame = 5;
        bear.x = 0;
        bear.y = 100;

        game.rootScene.addChild(bear);
    };
    game.start();
};

 

P18

enchant();

window.onload = function(){
    var game = new Core(320, 320);
    game.fps = 30;
    game.preload("chara1.png");
    game.onload = function(){
       bear = new Sprite(32, 32);
        bear.image = game.assets["chara1.png"];
        bear.frame = 6;
        game.rootScene.addChild(bear);
        bear.addEventListener(‘enterframe', function() {
        		this.x += 1;
         });
     
    };
    game.start();
};

 

P22

enchant();

window.onload = function(){
    var game = new Core(320, 320);
    game.fps = 8;
    game.preload("chara1.png");
    game.onload = function(){
       bear = new Sprite(32, 32);
        bear.image = game.assets["chara1.png"];
        bear.frame = 0;
        game.rootScene.addChild(bear);
	      bear.addEventListener(‘enterframe', function() {
            this.x += 1;
            this.frame = this.age%2+1;
         });
     
    };
    game.start();
};