line implementation

This commit is contained in:
2025-12-08 11:54:11 +01:00
parent 4a0d818604
commit 2c41e5dfea

View File

@@ -356,8 +356,37 @@ class Sprite extends Rectangle {
class Line extends Shape {
startX;
startY;
endX;
endY;
color;
width = 5;
constructor(startX, startY, endX, endY, color) {
super();
this.startX = startX;
this.startY = startY;
this.endX = endX;
this.endY = endY;
this.color = color;
}
draw(ctx) {
ctx.moveTo(this.startX, this.startY);
ctx.lineTo(this.endX, this.endY);
ctx.lineWidth = this.width;
ctx.stroke();
}
update() {
}
}