new fan level
This commit is contained in:
21
js/mob.js
21
js/mob.js
@@ -515,15 +515,24 @@ const mobs = {
|
||||
},
|
||||
springAttack() {
|
||||
// set new values of the ends of the spring constraints
|
||||
const stepRange = 600
|
||||
if (this.seePlayer.recall && Matter.Query.ray(map, this.position, player.position).length === 0) {
|
||||
if (!(game.cycle % (this.seePlayerFreq * 2))) {
|
||||
this.springTarget.x = this.seePlayer.position.x;
|
||||
this.springTarget.y = this.seePlayer.position.y;
|
||||
const unit = Vector.normalise(Vector.sub(this.seePlayer.position, this.position))
|
||||
const goal = Vector.add(this.position, Vector.mult(unit, stepRange))
|
||||
this.springTarget.x = goal.x;
|
||||
this.springTarget.y = goal.y;
|
||||
// this.springTarget.x = this.seePlayer.position.x;
|
||||
// this.springTarget.y = this.seePlayer.position.y;
|
||||
this.cons.length = -200;
|
||||
this.cons2.length = 100 + 1.5 * this.radius;
|
||||
} else {
|
||||
this.springTarget2.x = this.seePlayer.position.x;
|
||||
this.springTarget2.y = this.seePlayer.position.y;
|
||||
} else if (!(game.cycle % this.seePlayerFreq)) {
|
||||
const unit = Vector.normalise(Vector.sub(this.seePlayer.position, this.position))
|
||||
const goal = Vector.add(this.position, Vector.mult(unit, stepRange))
|
||||
this.springTarget2.x = goal.x;
|
||||
this.springTarget2.y = goal.y;
|
||||
// this.springTarget2.x = this.seePlayer.position.x;
|
||||
// this.springTarget2.y = this.seePlayer.position.y;
|
||||
this.cons.length = 100 + 1.5 * this.radius;
|
||||
this.cons2.length = -200;
|
||||
}
|
||||
@@ -1095,7 +1104,7 @@ const mobs = {
|
||||
mob.splice(i, 1);
|
||||
}
|
||||
});
|
||||
mob[i].alertRange2 = Math.pow(mob[i].radius * 3.5 + 550, 2);
|
||||
mob[i].alertRange2 = Math.pow(mob[i].radius * 3 + 550, 2);
|
||||
World.add(engine.world, mob[i]); //add to world
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user