new mob stabber

This commit is contained in:
landgreen
2020-04-20 18:08:02 -07:00
parent 4c535e3670
commit 929e4a30d7
5 changed files with 105 additions and 33 deletions

View File

@@ -782,23 +782,6 @@ const mobs = {
}
}
},
strike() {
//teleport to player when close enough on CD
if (this.seePlayer.recall && this.cd < game.cycle) {
const dist = Vector.sub(this.seePlayer.position, this.position);
const distMag = Vector.magnitude(dist);
if (distMag < 400) {
this.cd = game.cycle + this.delay;
ctx.beginPath();
ctx.moveTo(this.position.x, this.position.y);
Matter.Body.translate(this, Vector.mult(Vector.normalise(dist), distMag - 20 - radius));
ctx.lineTo(this.position.x, this.position.y);
ctx.lineWidth = radius * 2;
ctx.strokeStyle = this.fill; //"rgba(0,0,0,0.5)"; //'#000'
ctx.stroke();
}
}
},
blink() {
//teleport towards player as a way to move
if (this.seePlayer.recall && !(game.cycle % this.blinkRate)) {