summaryrefslogtreecommitdiff
path: root/src/entities/bigdump.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/entities/bigdump.js')
-rw-r--r--src/entities/bigdump.js40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/entities/bigdump.js b/src/entities/bigdump.js
new file mode 100644
index 0000000..90b4a57
--- /dev/null
+++ b/src/entities/bigdump.js
@@ -0,0 +1,40 @@
+import { ANTICHEESE } from "../assets.js"
+import { Vector } from "../engine/vector.js"
+import { Engine } from "../engine.js"
+import { Entity } from "./entity.js"
+import { boshy } from "../main.js"
+
+export class BigDump extends Entity {
+ constructor(bottom = false) {
+ let position = bottom ?
+ new Vector(0, boshy.position.y) :
+ new Vector(boshy.position.x, 0)
+
+ super({
+ size: new Vector(200, 10),
+ position: position,
+ sprite: ANTICHEESE,
+ degrees: bottom ? 270 : 0,
+ })
+
+ this.bottom = bottom
+ }
+
+ speed = 10
+ maxSize = 200
+
+ update() {
+ if (this.size.y < this.maxSize) this.size.y += this.speed * 0.75
+ if (this.bottom) this.position.x += this.speed
+ else this.position.y += this.speed
+
+ console.log("dump", this.position)
+
+ if (Engine.collision.collidingWithBoshy(this.position, this.hitbox)) {
+ boshy.die()
+ }
+ if (Engine.screen.isOffLimits(this.position, this.size)) {
+ this.remove()
+ }
+ }
+}