Began to implement more models

This commit is contained in:
s-prechtl 2022-11-29 11:20:01 +01:00
parent 59523f4a41
commit 6ca169fef8
3 changed files with 59 additions and 5 deletions

View file

@ -1,7 +1,8 @@
class Entity {
private _position: Position;
private _width: number;
private _height: number;
abstract class Entity {
private _position: Position;
private _width: number;
private _height: number;
private _fill: number;
get position(): Position {
return this._position;
@ -26,4 +27,17 @@ class Entity {
set height(value: number) {
this._height = value;
}
}
constructor(position: Position, width: number, height: number, fill: number) {
this.position = position;
this.width = width;
this.height = height;
this._fill = fill;
}
public abstract update();
public draw() {
fill(this._fill);
rect(this.position.x, this.position.y, this.width, this.height);
}
}