소스 검색

日常开发

林旭祥 1 개월 전
부모
커밋
476cf7c0a4
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  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);
         }