From 8adb249925d9a276713e51873438537d5fa26dc6 Mon Sep 17 00:00:00 2001 From: "Eevee (Evelyn Woods)" Date: Wed, 23 Sep 2020 23:38:10 -0600 Subject: [PATCH] Steam Teeth pursue the player's image --- js/game.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/js/game.js b/js/game.js index c6715a6..c84ec2c 100644 --- a/js/game.js +++ b/js/game.js @@ -509,8 +509,16 @@ export class Level { } else if (actor.type.movement_mode === 'pursue') { // teeth behavior: always move towards the player - let dx = actor.cell.x - this.player.cell.x; - let dy = actor.cell.y - this.player.cell.y; + let target_cell = this.player.cell; + // CC2 behavior (not Lynx (TODO compat?)): pursue the cell the player is leaving, if + // they're still mostly in it + if (this.player.previous_cell && this.player.animation_speed && + this.player.animation_progress <= this.player.animation_speed / 2) + { + target_cell = this.player.previous_cell; + } + let dx = actor.cell.x - target_cell.x; + let dy = actor.cell.y - target_cell.y; let preferred_horizontal, preferred_vertical; if (dx > 0) { preferred_horizontal = 'west';