feat(control) 摇杆优化

This commit is contained in:
chicrobot committed 2025-12-31 00:48:54 +08:00
1 parent 344d61d0fb
commit 3863cfe1f6
3 files changed
+68 -13

No files matched your search

+10 -1
View File
@@ -24,10 +24,14 @@ export default class GameScene extends Phaser.Scene {
this.textures.addCanvas('player', canvas);
}
// === 2. 扩大物理世界和相机边界(关键!)===
// === 2. 扩大物理世界和相机边界(关键!)===
const worldSize = 2000;
this.physics.world.setBounds(-worldSize, -worldSize, worldSize * 2, worldSize * 2);
this.cameras.main.setBounds(-worldSize, -worldSize, worldSize * 2, worldSize * 2);
// 设置相机起始位置在地图中心
// 使用centerOn方法将相机中心定位在地图坐标(0, 0)
this.cameras.main.centerOn(0, 0); // 地图中心坐标是(0, 0)
// === 3. 创建单位组 ===
this.unitGroup = this.add.group();
@@ -72,6 +76,11 @@ export default class GameScene extends Phaser.Scene {
if (this.miniMap) {
this.miniMap.update();
}
// 更新虚拟摇杆
if (this.virtualJoystick) {
this.virtualJoystick.update();
}
}
/**