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
老实说,我找不到有关限制的任何文档,似乎没有一个。