survivors: adding simple drops

moving size to world object
adding dying for enemies and projectiles and theoretically for players
adding pull range for player
adding money stat display
made pistol homing
This commit is contained in:
Sheldan
2025-08-21 16:44:20 +02:00
parent 18c323430c
commit c8767f1119
11 changed files with 388 additions and 81 deletions

View File

@@ -16,6 +16,10 @@ export class Vector {
return Math.sqrt(this.x * this.x + this.y * this.y);
}
clone() {
return new Vector(this.x, this.y)
}
distanceTo(point: Vector): number {
return Math.sqrt(Math.pow(this.x - point.x, 2) + Math.pow(this.y - point.y, 2));
}
@@ -56,4 +60,31 @@ export class Vector {
set y(value: number) {
this._y = value;
}
}
export class Cooldown {
private _currentValue;
private _totalValue;
constructor(totalValue) {
this._totalValue = totalValue;
this._currentValue = 0
}
cooledDown(): boolean {
return this.currentValue <= 0;
}
get currentValue(): number {
return this._currentValue;
}
decreaseCooldown() {
this._currentValue -= 1;
}
resetCooldown() {
this._currentValue = this._totalValue;
}
}