collapse Effect into Ability

This commit is contained in:
2025-01-12 13:58:35 +09:00
parent d9849f770b
commit d9d62d7070
4 changed files with 124 additions and 101 deletions
+4 -3
View File
@@ -32,8 +32,8 @@ export default class Projectile {
this.#homingTarget = value
}
constructor(...options) {
Object.entries(options).forEach((value, key) => this[key] = value)
constructor(options = {}) {
Object.entries(options).forEach(([key, value]) => this[key] = value)
}
get game() { return this.#game }
@@ -44,10 +44,11 @@ export default class Projectile {
set x(value) { this.position.x = value }
set y(value) { this.position.y = value }
set destination(value) { this.#dest = value }
set position(value) { this.#position = value }
checkCollisions() {
(this.game?.entities ?? []).filter((e) => e.id != this.id).forEach((e) => {
if (e.id == this.owner) { return }
if (e.id == this.owner?.id) { return }
if (SATX.collideObject(this.collider, e.collider)) {
this.onCollide(this, e)