Browse Source

日常开发

林旭祥 1 month ago
parent
commit
476cf7c0a4
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/views/game/football.vue

+ 3 - 3
src/views/game/football.vue

@@ -363,7 +363,7 @@ class GameScene extends Phaser.Scene {
   createPlayer() {
     // 创建玩家
     //this.player = this.physics.add.sprite(GAME_WIDTH / 2, GAME_HEIGHT - 100, 'playerAnim');
-    this.player = this.physics.add.sprite(direction.value, GAME_HEIGHT - 100, 'playerAnim');
+    this.player = this.physics.add.sprite(direction.value+46, GAME_HEIGHT - 100, 'playerAnim');
     this.player.setCollideWorldBounds(true);
     this.player.setScale(0.8);
     this.player.lives = this.lives;
@@ -940,13 +940,13 @@ class GameScene extends Phaser.Scene {
     if (this.player && this.player.active) {
       if (this.cursors.left.isDown) {
         //this.player.setVelocityX(-200);
-        this.player.setX(direction.value);
+        this.player.setX(direction.value+46);
         if (this.player.anims.currentAnim?.key !== 'playerLeft' && !this.player.anims.paused) {
           this.player.anims.play('playerLeft', true);
         }
       } else if (this.cursors.right.isDown) {
         //this.player.setVelocityX(200);
-        this.player.setX(direction.value);
+        this.player.setX(direction.value+46);
         if (this.player.anims.currentAnim?.key !== 'playerRight' && !this.player.anims.paused) {
           this.player.anims.play('playerRight', true);
         }