mirror of
https://github.com/Sheldan/canvas.git
synced 2026-04-22 05:51:23 +00:00
survivors: adding collision for faster projectiles to also consider collisions between ticks
differentiating between pistol and homing pistol using projectile speed for straight projectile
This commit is contained in:
@@ -9,6 +9,10 @@ export class Vector {
|
||||
return new Vector(tip.x - shaft.x, tip.y - shaft.y);
|
||||
}
|
||||
|
||||
static zero() {
|
||||
return new Vector(0, 0)
|
||||
}
|
||||
|
||||
normalize(): Vector {
|
||||
let length = this.vecLength();
|
||||
return new Vector(this.x / length, this.y / length)
|
||||
@@ -47,7 +51,7 @@ export class Vector {
|
||||
}
|
||||
|
||||
dotProduct(vector: Vector): number {
|
||||
return this._x * vector._x + this._y * vector._y;
|
||||
return (this._x * vector._x + this._y * vector._y) / Math.pow(vector.vecLength(), 2);
|
||||
}
|
||||
|
||||
angleTo(vector: Vector): number {
|
||||
|
||||
Reference in New Issue
Block a user