diff --git a/src/art/sounds/bite.mp3 b/src/art/sounds/bite.mp3 new file mode 100644 index 0000000..dcf6a4d Binary files /dev/null and b/src/art/sounds/bite.mp3 differ diff --git a/src/art/sounds/death.mp3 b/src/art/sounds/death.mp3 new file mode 100644 index 0000000..35de5b1 Binary files /dev/null and b/src/art/sounds/death.mp3 differ diff --git a/src/art/sounds/dig.mp3 b/src/art/sounds/dig.mp3 new file mode 100644 index 0000000..01b0f9f Binary files /dev/null and b/src/art/sounds/dig.mp3 differ diff --git a/src/art/sounds/recruit.mp3 b/src/art/sounds/recruit.mp3 new file mode 100644 index 0000000..6649df0 Binary files /dev/null and b/src/art/sounds/recruit.mp3 differ diff --git a/src/art/sounds/reward_big.mp3 b/src/art/sounds/reward_big.mp3 new file mode 100644 index 0000000..7e828bd Binary files /dev/null and b/src/art/sounds/reward_big.mp3 differ diff --git a/src/art/sounds/reward_huge.mp3 b/src/art/sounds/reward_huge.mp3 new file mode 100644 index 0000000..fc7fa93 Binary files /dev/null and b/src/art/sounds/reward_huge.mp3 differ diff --git a/src/art/sounds/reward_medium.mp3 b/src/art/sounds/reward_medium.mp3 new file mode 100644 index 0000000..6780be9 Binary files /dev/null and b/src/art/sounds/reward_medium.mp3 differ diff --git a/src/art/sounds/reward_small.mp3 b/src/art/sounds/reward_small.mp3 new file mode 100644 index 0000000..23ded73 Binary files /dev/null and b/src/art/sounds/reward_small.mp3 differ diff --git a/src/art/sounds/sleep.mp3 b/src/art/sounds/sleep.mp3 new file mode 100644 index 0000000..a5831a7 Binary files /dev/null and b/src/art/sounds/sleep.mp3 differ diff --git a/src/huntmode.ts b/src/huntmode.ts index 881144d..6a5b3d2 100644 --- a/src/huntmode.ts +++ b/src/huntmode.ts @@ -196,11 +196,34 @@ export class HuntMode { this.faceLeft = false; } - let szX = 0.1; - let szY = 0.1; + let szX = 0.5; + let szY = 0.5; this.velocity = new Point(dx, dy); + // try to push us away from walls if we're close + for (let offset of CARDINAL_DIRECTIONS.values()) { + let bigBbox = new Rect( + this.floatingPlayer + .offset(offset.scale(new Size(0.06, 0.06))) + .offset(new Point(-szX / 2, -szY / 2)), + new Size(szX, szY), + ); + + let hitsWall = false; + for (let cell of bigBbox.overlappedCells(new Size(1, 1)).values()) { + if (this.#blocksMovement(cell.top)) { + hitsWall = true; + break; + } + } + if (hitsWall) { + this.velocity = this.velocity.offset( + offset.scale(new Point(0.005, 0.005)).negate(), + ); + } + } + let origin = new Point(szX / 2, szY / 2); let bbox = new Rect( this.floatingPlayer.offset(origin.negate()), @@ -210,44 +233,9 @@ export class HuntMode { this.isBlocked(b), ); this.floatingPlayer = this.floatingPlayer.offset(displacement); - // this.velocity = dxy; + // this.velocity = dxy; // don't let the wall break our speed, this sucks on corners + // let friction do it getPlayerProgress().spendBlood(displacement.distance(new Point(0, 0)) * 10); - - // try to push us away from walls if we're close - for (let { dist, strength } of [ - { dist: 0.12, strength: 0.02 }, - { dist: 0.22, strength: 0.015 }, - { dist: 0.32, strength: 0.01 }, - ].values()) { - for (let offset of CARDINAL_DIRECTIONS.values()) { - let bigBbox = new Rect( - this.floatingPlayer - .offset(offset.scale(new Size(dist, dist))) - .offset(new Point(-szX / 2, -szY / 2)), - new Size(szX, szY), - ); - - let hitsWall = false; - for (let cell of bigBbox.overlappedCells(new Size(1, 1)).values()) { - if (this.#blocksMovement(cell.top)) { - hitsWall = true; - break; - } - } - if (hitsWall) { - bbox = new Rect( - this.floatingPlayer.offset(origin.negate()), - new Size(szX, szY), - ); - let { displacement } = displace( - bbox, - offset.scale(new Point(strength, strength)).negate(), - (b: Rect) => this.isBlocked(b), - ); - this.floatingPlayer = this.floatingPlayer.offset(displacement); - } - } - } } #updateFov() {