blob: d7a20ba89735ff9de5c83e8d31ba0cdb091ec7c4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
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
this.updateAsHazard()
this.checkBounds()
if (Engine.screen.isOffLimits(this.position, this.size)) {
this.remove()
}
}
}
|