diff options
author | niliara-edu <nil.jimeno@estudiant.fjaverianas.com> | 2024-12-27 18:30:10 +0100 |
---|---|---|
committer | niliara-edu <nil.jimeno@estudiant.fjaverianas.com> | 2024-12-27 18:30:10 +0100 |
commit | 0696b94962a0571fad54844f137dca025df4563b (patch) | |
tree | 8aeff72e8fc46a7dab2b2f556febd962e3f67e4b /src/entities/entity.js | |
parent | 474a7253b6b67e2ed33936f6b633587d5d304b66 (diff) |
game finished, only assets left
Diffstat (limited to 'src/entities/entity.js')
-rw-r--r-- | src/entities/entity.js | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/entities/entity.js b/src/entities/entity.js index 0dbe00c..2b3ab71 100644 --- a/src/entities/entity.js +++ b/src/entities/entity.js @@ -1,6 +1,6 @@ import { Vector } from "../engine/vector.js" import { Engine } from "../engine.js" -import { entities } from "../main.js" +import { entities, boshy } from "../main.js" export class Entity { rotation = 0 @@ -37,4 +37,16 @@ export class Entity { this.span.remove() entities.remove(this) } + + updateAsHazard() { + if (Engine.collision.collidingWithBoshy(this.position, this.hitbox)) { + boshy.die() + } + } + + checkBounds() { + if (Engine.screen.isOffLimits(this.position, this.size)) { + this.remove() + } + } } |