From 91ead45d5d153b1df730a640fb508d0584562c98 Mon Sep 17 00:00:00 2001 From: chicrobot Date: Fri, 9 Jan 2026 14:11:33 +0800 Subject: [PATCH] =?UTF-8?q?fix(CATS)=20=E8=A7=92=E8=89=B2=E5=8A=A8?= =?UTF-8?q?=E7=94=BB=E6=B5=8B=E8=AF=95=E5=9C=BA=E6=99=AF=E9=94=AE=E7=9B=98?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/CharacterAnimationTestScene.js | 31 +++------------------------ 1 file changed, 3 insertions(+), 28 deletions(-) diff --git a/scenes/CharacterAnimationTestScene.js b/scenes/CharacterAnimationTestScene.js index eb57ce2..c5285d0 100644 --- a/scenes/CharacterAnimationTestScene.js +++ b/scenes/CharacterAnimationTestScene.js @@ -12,7 +12,7 @@ import Unit from '../objects/Unit.js'; export default class CharacterAnimationTestScene extends Phaser.Scene { constructor() { super({ key: 'CharacterAnimationTestScene' }); - this.tileSize = 32; // 瓦片大小 + this.tileSize = 16; // 瓦片大小 this.player = null; // 玩家角色 this.inputSystem = null; // 输入系统 this.selectionSystem = null; // 选择系统 @@ -76,15 +76,6 @@ export default class CharacterAnimationTestScene extends Phaser.Scene { // 显示提示信息 this.showInstructions(); - - // 添加相机移动控制 - this.cameraSpeed = 2; - this.cameraKeys = this.input.keyboard.addKeys({ - up: Phaser.Input.Keyboard.KeyCodes.W, - down: Phaser.Input.Keyboard.KeyCodes.S, - left: Phaser.Input.Keyboard.KeyCodes.A, - right: Phaser.Input.Keyboard.KeyCodes.D - }); } /** @@ -176,9 +167,7 @@ export default class CharacterAnimationTestScene extends Phaser.Scene { */ setupInput() { // 只保留必要的按键监听,键盘移动由InputSystem处理 - this.keys = { - space: this.input.keyboard.addKey(Phaser.Input.Keyboard.KeyCodes.SPACE) - }; + this.cursors = this.input.keyboard.createCursorKeys(); // 切换角色按钮 this.createButton(this.sys.game.config.width - 200, 100, '切换角色', () => { @@ -285,20 +274,6 @@ export default class CharacterAnimationTestScene extends Phaser.Scene { // 更新输入系统 this.inputSystem.update(); - // 更新相机移动 - if (this.cameraKeys.left.isDown) { - this.cameras.main.scrollX -= this.cameraSpeed; - } - if (this.cameraKeys.right.isDown) { - this.cameras.main.scrollX += this.cameraSpeed; - } - if (this.cameraKeys.up.isDown) { - this.cameras.main.scrollY -= this.cameraSpeed; - } - if (this.cameraKeys.down.isDown) { - this.cameras.main.scrollY += this.cameraSpeed; - } - // 更新所有单位 this.unitGroup.getChildren().forEach(unit => { if (unit.update) { @@ -311,7 +286,7 @@ export default class CharacterAnimationTestScene extends Phaser.Scene { }); // 按空格键返回启动场景 - if (this.keys.space.isDown) { + if (this.cursors.space.isDown) { this.scene.start('BootScene'); } }