diff --git a/src/assets/images/ui/bubble.png b/src/assets/images/ui/bubble.png index 88bebb9..470fdb8 100644 Binary files a/src/assets/images/ui/bubble.png and b/src/assets/images/ui/bubble.png differ diff --git a/src/components/Customer.ts b/src/components/Customer.ts index c3145d4..bf0e186 100644 --- a/src/components/Customer.ts +++ b/src/components/Customer.ts @@ -235,10 +235,10 @@ export class Customer extends Button { ); this.emit("pay", this.moneySpent); } else { - this.scene.sound.play("rip", { volume: 0.4 }); + this.scene.sound.play("rip", { volume: 0.3 }); } } else { - this.scene.sound.play("rip", { volume: 0.4 }); + this.scene.sound.play("rip", { volume: 0.3 }); } this.leave(); this.thoughtBubble.showSymbol("sad"); @@ -269,7 +269,7 @@ export class Customer extends Button { } } if (this.playFail) { - this.scene.sound.play("rip", { volume: 0.4 }); + this.scene.sound.play("rip", { volume: 0.3 }); this.playFail = false; } } @@ -422,7 +422,7 @@ export class Customer extends Button { this.untoggleTimer(); this.lockTimer(); } - this.thoughtBubble.showSymbol(Phaser.Math.RND.pick(["happy", "love"])); + this.thoughtBubble.showSymbol("love"); } setAction(temp: boolean) { @@ -513,6 +513,8 @@ export class Customer extends Button { this.emit("offscreen"); }, }); + + // this.scene.moveCustomerToEntrance(this); } recheckHappiness() { if (this.hasCompleted) { diff --git a/src/components/PatienceTimer.ts b/src/components/PatienceTimer.ts index 61fd1b7..a29e557 100644 --- a/src/components/PatienceTimer.ts +++ b/src/components/PatienceTimer.ts @@ -35,6 +35,7 @@ export class PatienceTimer extends Phaser.GameObjects.Container { this.sparks = new Phaser.GameObjects.Sprite(this.scene,0,64,"defaultspark"); this.sparks.setTint(0x00FF00); this.sparks.setScale(0.5); + this.anger.setVisible(false); this.add(this.bar); this.add(this.sparks); diff --git a/src/scenes/GameScene.ts b/src/scenes/GameScene.ts index a051c3f..30bc038 100644 --- a/src/scenes/GameScene.ts +++ b/src/scenes/GameScene.ts @@ -679,29 +679,7 @@ export class GameScene extends BaseScene { customer.setStation(seat); // customer.snapTo(seat.x, seat.y); - // Pathfinding to seat - const startY = LevelData[this.level].height - 3; - const startCoord = this.board.gridToCoord(0, startY); - const start = this.board.coordToNav(startCoord.x, startCoord.y); - const goal = this.board.coordToNav(seat.x, seat.y); - - // Starting location outside of screen - customer.snapTo(startCoord.x - 2 * this.board.size, startCoord.y, true); - - const navPath = this.navmesh.findPath(start, goal); - if (navPath) { - const points = navPath.map((pos) => - this.board.navGridToCoord(pos.x, pos.y) - ); - const path = new Phaser.Curves.Path(); - path.moveTo(customer.x, customer.y); - points.forEach((point) => path.lineTo(point.x, point.y)); - - customer.walk(path); - } else { - // Snap to station if pathfinding fails - console.warn("No path found", start, "->", goal); - } + this.moveCustomerToSeat(customer, seat); } else { console.error("Whoops"); } @@ -908,6 +886,58 @@ export class GameScene extends BaseScene { } } + moveCustomerToSeat(customer: Customer, seat: Station) { + // Pathfinding to seat + const startY = LevelData[this.level].height - 3; + const startCoord = this.board.gridToCoord(0, startY); + const start = this.board.coordToNav(startCoord.x, startCoord.y); + const goal = this.board.coordToNav(seat.x, seat.y); + + // Starting location outside of screen + customer.snapTo(startCoord.x - 2 * this.board.size, startCoord.y, true); + + const navPath = this.navmesh.findPath(start, goal); + if (navPath) { + const points = navPath.map((pos) => + this.board.navGridToCoord(pos.x, pos.y) + ); + const path = new Phaser.Curves.Path(); + path.moveTo(customer.x, customer.y); + points.forEach((point) => path.lineTo(point.x, point.y)); + + customer.walk(path); + } else { + const path = new Phaser.Curves.Path(); + path.moveTo(customer.x, customer.y); + path.lineTo(seat.x, seat.y); + } + } + + moveCustomerToEntrance(customer: Customer) { + // Pathfinding to left entrance + const doorY = LevelData[this.level].height - 3; + const doorCoord = this.board.gridToCoord(0, doorY); + const goal = this.board.coordToNav(doorCoord.x, doorCoord.y); + const start = this.board.coordToNav(customer.x, customer.y); + + const navPath = this.navmesh.findPath(start, goal); + if (navPath) { + const points = navPath.map((pos) => + this.board.navGridToCoord(pos.x, pos.y) + ); + const path = new Phaser.Curves.Path(); + path.moveTo(customer.x, customer.y); + points.forEach((point) => path.lineTo(point.x, point.y)); + path.lineTo(-this.board.size, doorCoord.y); + + customer.walk(path); + } else { + const path = new Phaser.Curves.Path(); + path.moveTo(customer.x, customer.y); + path.lineTo(doorCoord.x, doorCoord.y); + } + } + // Generate a list of requests for the customer setCustomerItinerary(customer: Customer) { // Check availibility of stations