diff --git a/frontend/model/Obstacle.ts b/frontend/model/Obstacle.ts index da11b58..9a64306 100644 --- a/frontend/model/Obstacle.ts +++ b/frontend/model/Obstacle.ts @@ -37,17 +37,16 @@ class Obstacle extends Entity implements Collidable { */ public resetPosition(): void { this.randomizeHeight(); - - this.pipeBottom.position.x = Obstacle.startX; - this.pipeTop.position.x = Obstacle.startX; + this.pipeBottom.position.x = Obstacle._startX; + this.pipeTop.position.x = Obstacle._startX; } /** * Randomizes the height of the pipes */ public randomizeHeight(): void { - this.pipeTop.height = this.randomRange(this.padding, height - this.padding - Obstacle.distanceBetweenPipes); - this.pipeBottom.position.y = this.pipeTop.height + Obstacle.distanceBetweenPipes; + this.pipeTop.height = this.randomRange(this.padding, height - this.padding - Obstacle._distanceBetweenPipes); + this.pipeBottom.position.y = this.pipeTop.height + Obstacle._distanceBetweenPipes; this.pipeBottom.height = height - this.pipeTop.height - this.padding; } diff --git a/frontend/model/Raspberry.ts b/frontend/model/Raspberry.ts index 861055d..36fb3a2 100644 --- a/frontend/model/Raspberry.ts +++ b/frontend/model/Raspberry.ts @@ -5,7 +5,7 @@ class Raspberry extends Entity { private _image: any; private static readonly maxVelocity: number = 100; - private static readonly POSITION: Position = new Position(width / 6, height / 2); + private static POSITION: Position; private static readonly WIDTH: number = 180; private static readonly HEIGHT: number = 70; private static readonly FILL: number = 0; @@ -33,6 +33,7 @@ class Raspberry extends Entity { * Constructs the Raspberry with fixed sizes */ constructor(image: string) { + Raspberry.POSITION = new Position(width / 6, height / 2) super(Raspberry.POSITION, Raspberry.WIDTH, Raspberry.HEIGHT, Raspberry.FILL); this.image = image; }