blob: ed91edee6a6b3a409cc53a1af8ecd86fea9580ef (
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
|
import { BOSHY } from "../assets.js"
import { Vector } from "../engine/vector.js"
import { bullets } from "../main.js"
import { Entity } from "./entity.js"
export class BoshyBullet extends Entity {
speed = 20
constructor(position = new Vector(0,0)) {
super({
size: new Vector(5, 5),
position: position.floor(),
sprite: BOSHY.BULLET,
})
bullets.list.push(this)
}
update() {
this.position.y -= this.speed
if (this.position.y < 0) {
this.span.remove()
bullets.remove(this)
}
}
remove() {
this.span.remove()
}
}
|