code review

This commit is contained in:
s-prechtl 2022-12-13 08:33:37 +01:00
parent ba2d9f17e1
commit 7d84f51d91
3 changed files with 9 additions and 12 deletions

View file

@ -1,9 +1,9 @@
class Obstacle extends Entity {
private pipeTop: Pipe;
private pipeBottom: Pipe;
private distanceBetweenPipes: number;
private padding: number = 300;
private speed: number = 8;
private readonly distanceBetweenPipes: number;
private readonly padding: number = 300;
private readonly speed: number = 8;
private static startX: number;

View file

@ -18,7 +18,6 @@ class Pipe extends Entity {
public update(): void {}
public draw(): void {
// @ts-ignore
image(this.image, this.position.x, this.position.y, this.width, this.height);
noFill();
rect(

View file

@ -1,9 +1,9 @@
class Raspberry extends Entity {
private lift: number = -10;
private gravity: number = 1;
private readonly lift: number = -10;
private readonly gravity: number = 1;
private _velocity: number = 0;
private _image: any;
private static maxVelocity: number = 5;
private static readonly maxVelocity: number = 5;
constructor() {
super(new Position(width / 6, height / 2), 180, 70, 0);
@ -34,9 +34,7 @@ class Raspberry extends Entity {
}
private applyGravity(): void {
if (this.position.y - this.height > 0) {
this.velocity += this.gravity;
}
this.velocity += this.gravity;
}
private forceBoundaries(): void {