blob: ac14d4bbbe4bcd760faa23c02e7381ecd0153be1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import { Vector } from "../engine/vector.js"
import { Engine } from "../engine.js"
export class Entity {
constructor({
size,
hitbox = size,
sprite,
position = new Vector(0,0),
}) {
this.size = size
this.hitbox = hitbox
this.position = position
this.span = document.createElement("img")
this.span.src = sprite
Engine.screen.append(this.span)
}
draw() {
Engine.screen.draw(this.span, this.position, this.size)
}
}
|