survivors: reducing jumpiness of homing projectiles re-directing by limiting it to a certain angle

adding rad degree conversion utils checking world border for projectiles
This commit is contained in:
Sheldan
2025-08-21 17:48:16 +02:00
parent c8767f1119
commit 71f48404c9
4 changed files with 61 additions and 4 deletions

View File

@@ -1,3 +1,5 @@
import type {Placeable} from "./interfaces.ts";
export class Vector {
constructor(private _x: number, private _y: number) {
@@ -44,6 +46,13 @@ export class Vector {
return this.multiply(-1)
}
dotProduct(vector: Vector): number {
return this._x * vector._x + this._y * vector._y;
}
angleTo(vector: Vector): number {
return Math.acos(this.dotProduct(vector))
}
get x(): number {
return this._x;
@@ -87,4 +96,25 @@ export class Cooldown {
resetCooldown() {
this._currentValue = this._totalValue;
}
}
export class Point implements Placeable {
private position: Vector;
constructor(position: Vector) {
this.position = position;
}
getPosition(): Vector {
return this.position;
}
getSize() {
}
move(any?: any) {
}
}