summaryrefslogtreecommitdiff
path: root/src/entities/entity.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/entities/entity.js')
-rw-r--r--src/entities/entity.js14
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()
+ }
+ }
}