From 0696b94962a0571fad54844f137dca025df4563b Mon Sep 17 00:00:00 2001 From: niliara-edu Date: Fri, 27 Dec 2024 18:30:10 +0100 Subject: game finished, only assets left --- src/entities/entity.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/entities/entity.js') 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() + } + } } -- cgit v1.2.3