Skip to content

Commit

Permalink
Fix Bargland for new falling damage system
Browse files Browse the repository at this point in the history
  • Loading branch information
lorgan3 committed Apr 25, 2024
1 parent 526f279 commit 946fec0
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/data/spells/rock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import { ControllableSound } from "../../sound/controllableSound";
import { Sound } from "../../sound";
import { probeX } from "../map/utils";
import { CollisionMask } from "../collision/collisionMask";
import { Manager } from "../network/manager";
import { TurnState } from "../network/types";
import { StaticBody } from "../collision/staticBody";
import { ExplosiveDamage } from "../damage/explosiveDamage";

export class Rock extends Container implements Spawnable {
private static growTime = 100;
Expand Down Expand Up @@ -124,18 +123,20 @@ export class Rock extends Container implements Spawnable {
const [x, y] = entity.body.precisePosition;
entity.body.move(x, y - amount);
} else {
// If you're deep in the rock, push harder so you take damage
// If you're deep in the rock, make some room with an explosion
if (
this.collisionMask.collidesWith(
entity.body.mask,
ex - (this._x - 24),
ey - (this._y - 48 + 8) - 48 + Math.floor(this.sprite.height)
)
) {
entity.body.addVelocity(0, -10 * dt);
} else {
entity.body.addVelocity(0, -0.5 * dt);
Level.instance.damage(
new ExplosiveDamage(ex + 3, ey + 3, 8, -2, 1) // Negative power to push the player up
);
}

entity.body.addVelocity(0, -0.5 * dt);
}
}
}
Expand Down

0 comments on commit 946fec0

Please sign in to comment.