initial commit

This commit is contained in:
armel committed 2026-09-07 20:37:40 +02:00
commit e8c3f9862a
193 files changed
+29795

No files matched your search

+49
View File
@@ -0,0 +1,49 @@
import { GameObject } from '../engine/GameObject.js';
import { Vector2D } from '../engine/Vector2D.js';
export class WitchProjectile extends GameObject {
constructor(
x,
y,
direction,
{ container, viewport, speed = 220, size = 12, color = [0.7, 0.2, 1, 1] } = {},
) {
super(x, y);
this.velocity = direction.mulS(speed);
this.container = container;
this.viewport = viewport;
this.size = size;
this.color = color;
this.width = size;
this.height = size;
this._time = 0;
}
update(dt) {
super.update(dt);
this._time += dt;
const { width, height } = this.viewport;
if (
this.pos.x < -this.size ||
this.pos.x > width + this.size ||
this.pos.y < -this.size ||
this.pos.y > height + this.size
) {
this.remove(this.container);
}
}
draw(renderer) {
const pulse = 1 + 0.15 * Math.sin(this._time * 12);
const s = this.size * pulse;
renderer.drawTexture(
renderer.whiteTexture,
this.pos.x - s / 2,
this.pos.y - s / 2,
s,
s,
this.color,
);
}
}