※リストが表示されない場合
AddBlockなどの広告ブロックツールがONになっているとリストなどが表示されない場合があります。これらのツールをOFFにしてみてください。
var game = null;
var char1 = null;
var map = null;
var here = {x:50, y:50};
enchant();
window.onload = function(){
game = new Game(500, 500);
game.fps = 10;
game.preload("minicharacter.png","mapdata.png");
game.onload = function(){
map = new Map(50, 50);
map.image = game.assets['mapdata.png'];
var data = [
[0,0,0,0,0,0,0,0,0,0],
[0,2,2,2,2,2,2,2,2,0],
[0,2,3,3,3,2,3,3,2,0],
[0,2,3,2,2,2,2,3,2,0],
[0,2,2,2,0,0,2,3,2,0],
[0,2,3,2,0,0,2,2,2,0],
[0,2,3,2,2,2,2,3,2,0],
[0,2,3,3,2,3,3,3,2,0],
[0,2,2,2,2,2,2,2,2,0],
[0,0,0,0,0,0,0,0,0,0]
];
var cdata = [
[1,1,1,1,1,1,1,1,1,1],
[1,0,0,0,0,0,0,0,0,1],
[1,0,1,1,1,0,1,1,0,1],
[1,0,1,0,0,0,0,1,0,1],
[1,0,0,0,1,1,0,1,0,1],
[1,0,1,0,1,1,0,0,0,1],
[1,0,1,0,0,0,0,1,0,1],
[1,0,1,1,0,1,1,1,0,1],
[1,0,0,0,0,0,0,0,0,1],
[1,1,1,1,1,1,1,1,1,1]
];
map.loadData(data);
map.collisionData = cdata;
game.rootScene.addChild(map);
char1 = new Sprite(50, 50);
char1.image = game.assets["minicharacter.png"];
char1.x = 50;
char1.y = 50;
char1.frame = 0;
char1.addEventListener(enchant.Event.ENTER_FRAME, charMove);
game.rootScene.addChild(char1);
};
game.start();
};
function charMove(){
this.frame = this.age % 2;
var nx = here.x;
var ny = here.y;
if (game.input.right) { nx += 50; }
if (game.input.left) { nx -= 50; }
if (game.input.up) { ny -= 50; }
if (game.input.down) { ny += 50; }
if (!map.hitTest(nx, ny)){
here.x = nx;
here.y = ny;
char1.moveTo(here.x, here.y);
}
}
| << 前へ |