Refactor & Bug Fix
`game.ts` - fixed score on new game `Obstacle.ts` - made distanceBetweenPipes and startX public - moved initialization of distanceBetweenPipes and startX to game.setupGame() `Pipe.ts` - created move() method to move the pipe `Raspberry.ts` - added constant variables for Raspberry size
This commit is contained in:
parent
a16f1203ff
commit
d98cd7b10e
4 changed files with 25 additions and 16 deletions
|
|
@ -37,6 +37,14 @@ class Pipe extends Entity implements Collidable {
|
|||
pop();
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves the pipe to the lift with the given speed
|
||||
* @param speed how fast the pipe moves
|
||||
*/
|
||||
public move(speed: number): void {
|
||||
this.position.x -= speed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines when the pipe is colliding with another entity
|
||||
* @param o other entity
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue