0
Q
設置世界界限
A
回答
2
我一直未能在documentation或source中找到任何提及的世界限制。
此外,狀態(TypeScript)中的以下代碼在直接請求時以及在相機調試信息中正確返回設置的世界寬度和高度。
module TestingProject {
export class WorldBounds extends Phaser.State {
init() {
this.game.world.setBounds(0, 0, 1400, 900000);
}
create() {
var fontStyle = { fill: '#fff' };
// Returns 1400
var worldWidthText = this.game.add.text(50, 150,
"World width: " + this.game.world.bounds.width, fontStyle);
// Returns 900000
var worldHeightText = this.game.add.text(50, 200,
"World height: " + this.game.world.bounds.height, fontStyle);
}
render() {
// Returns bounds of x,y = 0,0 and w,h = 1400,900000
this.game.debug.cameraInfo(this.camera, 50, 50);
}
}
}
0
老實說,我找不到有關限制的任何文檔,似乎沒有一個。