diff options
author | niliara-edu <nil.jimeno@estudiant.fjaverianas.com> | 2024-12-23 18:32:29 +0100 |
---|---|---|
committer | niliara-edu <nil.jimeno@estudiant.fjaverianas.com> | 2024-12-23 18:32:29 +0100 |
commit | a840990bdcabf45fb0d377478ba0ab27222434ae (patch) | |
tree | 030a6c3a6befce284733f5643d3972e3a1504bb2 /src/entities/entity.js |
initial commit
Diffstat (limited to 'src/entities/entity.js')
-rw-r--r-- | src/entities/entity.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/entities/entity.js b/src/entities/entity.js new file mode 100644 index 0000000..ac14d4b --- /dev/null +++ b/src/entities/entity.js @@ -0,0 +1,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) + } +} |