1
爲什麼我的Phaser.js的重疊有時候並沒有時間。 我已經爲我的角色和障礙啓用了街機。 這裏是代碼。Phaser重疊不起作用
function create(){
...//other sprite
obs = game.add.group();
obs.enableBody = true;
obstacle = obs.create(800, game.world.height - 68, 'obstacle');
obstacle.scale.setTo(0.5,0.5);
game.physics.arcade.enable(obstacle);
obstacle.events.onOutOfBounds.add(function(obstacle) {
obstacle.kill();
}, this);
}
function update(){
...
game.physics.arcade.collide(character, obstacle, gameOver, null, this);
}
function generateObs(){//its where i generate new obstacle, and is my biggest suspect as well
obstacle = obs.create(800, game.world.height - 68, 'obstacle');
obstacle.scale.setTo(0.5,0.5);
game.physics.arcade.enable(obstacle);
obstacle.body.velocity.x = -300;
}
THKS很多
它有很大幫助,THKS隊友! – AndresJay