aaa
This commit is contained in:
parent
f1c3af2b89
commit
2636d580a8
75 changed files with 3890 additions and 1084 deletions
15
js/ants.js
15
js/ants.js
|
|
@ -259,7 +259,20 @@ class AntActor {
|
|||
if (this.dead) return;
|
||||
const hpBefore = this.hp;
|
||||
this.age += dt;
|
||||
if (this.burning || (this.burnTimer || 0) > 0.02) {
|
||||
if (Number(this.electricShockUntil || 0) > Number(this.world?.time || 0)) {
|
||||
this.state = "panic";
|
||||
this.targetId = "";
|
||||
this.targetToken = 0;
|
||||
this.targetRef = null;
|
||||
this.nextTurn = Math.min(Number(this.nextTurn || 0), 0);
|
||||
this.wanderAngle = Number(this.wanderAngle || 0) + rand(-2.4, 2.4);
|
||||
const shockSpeed = (this.kind === "queen" ? ANT_QUEEN_SPEED : ANT_WORKER_RETURN_SPEED) * 1.75;
|
||||
this.vx = Math.cos(this.wanderAngle) * shockSpeed;
|
||||
this.vy = Math.sin(this.wanderAngle) * shockSpeed;
|
||||
this.x = clamp(this.x + this.vx * dt, CONFIG.worldPadding, this.world.w - CONFIG.worldPadding);
|
||||
this.y = clamp(this.y + this.vy * dt, CONFIG.worldPadding, this.world.h - CONFIG.worldPadding);
|
||||
if (this.hp <= 0) this.dieAsCorpse(this.homeNest?.() || null);
|
||||
} else if (this.burning || (this.burnTimer || 0) > 0.02) {
|
||||
this.updateBurning(dt);
|
||||
if (this.hp <= 0) this.dieAsCorpse(this.homeNest?.() || null);
|
||||
} else if (this.kind === "queen") this.updateQueen(dt);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue