Formatted files, added types and updated class diagram
This commit is contained in:
parent
4d22976621
commit
f272d3a44f
6 changed files with 52 additions and 32 deletions
|
|
@ -21,7 +21,7 @@ class Obstacle extends Entity {
|
|||
Obstacle.startX = width;
|
||||
}
|
||||
|
||||
public resetPosition() {
|
||||
public resetPosition(): void {
|
||||
this.pipeBottom.position.y = this.distanceBetweenPipes + this.randomRange(0, height - this.padding - 1.2 * this.distanceBetweenPipes);
|
||||
this.pipeBottom.position.x = Obstacle.startX;
|
||||
|
||||
|
|
@ -29,16 +29,16 @@ class Obstacle extends Entity {
|
|||
this.pipeTop.position.x = Obstacle.startX;
|
||||
}
|
||||
|
||||
private randomRange(min: number, max: number) {
|
||||
private randomRange(min: number, max: number): number {
|
||||
return Math.random() * (max - min) + min;
|
||||
}
|
||||
|
||||
public update() {
|
||||
public update(): void {
|
||||
this.pipeTop.position.x -= this.speed;
|
||||
this.pipeBottom.position.x -= this.speed;
|
||||
}
|
||||
|
||||
public draw() {
|
||||
public draw(): void {
|
||||
fill(10, 200, 100); //TODO do not make static
|
||||
rect(
|
||||
this.pipeTop.position.x,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue