From 226b081c16a3a2f16e35a408ef1bc79b60934738 Mon Sep 17 00:00:00 2001 From: Daniel Bulant Date: Fri, 9 Apr 2021 09:29:46 +0200 Subject: [PATCH] move clouds separately --- src/game/gameScene.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/game/gameScene.js b/src/game/gameScene.js index 3f94f55..9029ee8 100644 --- a/src/game/gameScene.js +++ b/src/game/gameScene.js @@ -197,10 +197,19 @@ export class GameScene extends Phaser.Scene { var toY = this.player.y + moveY; if(toX > this.map.size.x - 1 || toX < 0 || toY > this.map.size.y - 1 || toY < 0) return; if(this.items[toX][toY]) { - if(this.items[toX][toY].type !== "lyre") return; - if(toX + moveX > this.map.size.x - 1|| toX + moveX < 0 || toY + moveY > this.map.size.y - 1 || toY + moveY < 0) return; - if(this.items[toX + moveX][toY + moveY] && this.items[toX + moveX][toY + moveY].type !== "wind") return; - this.move(toX, toY, toX + moveX, toY + moveY); + if(this.items[toX][toY].type !== "lyre") return; + if(toX + moveX > this.map.size.x - 1|| toX + moveX < 0 || toY + moveY > this.map.size.y - 1 || toY + moveY < 0) return; + if(this.items[toX + moveX][toY + moveY] && this.items[toX + moveX][toY + moveY].type !== "wind") return; + if(stepNum <= 0) { + this.unload(); + this.createMap(); + return; + } + this.canMove = false; + this.move(toX, toY, toX + moveX, toY + moveY, () => { + this.canMove = true; + }); + return; } if(stepNum <= 0) { this.unload();