summaryrefslogtreecommitdiff
path: root/src/entities/boshyblood.js
diff options
context:
space:
mode:
authorniliara-edu <nil.jimeno@estudiant.fjaverianas.com>2024-12-24 17:58:20 +0100
committerniliara-edu <nil.jimeno@estudiant.fjaverianas.com>2024-12-24 17:58:20 +0100
commit25adfc618e77db9a5ee3b98ce0dab0be832efed0 (patch)
tree36ca56758ddd4674ab5a43df4b76bbfcc5a47af1 /src/entities/boshyblood.js
parenta840990bdcabf45fb0d377478ba0ab27222434ae (diff)
hello kitty base done
Diffstat (limited to 'src/entities/boshyblood.js')
-rw-r--r--src/entities/boshyblood.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/entities/boshyblood.js b/src/entities/boshyblood.js
new file mode 100644
index 0000000..af4a97d
--- /dev/null
+++ b/src/entities/boshyblood.js
@@ -0,0 +1,25 @@
+import { BOSHY } from "../assets.js"
+import { Vector } from "../engine/vector.js"
+import { Engine } from "../engine.js"
+import { Entity } from "./entity.js"
+
+export class Blood extends Entity {
+ constructor(position) {
+ super({
+ size: new Vector(6, 6),
+ position: position,
+ sprite: BOSHY.BLOOD,
+ })
+
+ let max_speed = 20
+ this.velocity = new Vector(Engine.random(-max_speed, max_speed),Engine.random(-max_speed, max_speed))
+ this.gravity = 1
+ }
+
+
+ update() {
+ this.position.add(this.velocity)
+ if (Engine.screen.isOffLimits(this.position, this.size)) this.remove()
+ this.velocity.y += this.gravity
+ }
+}