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
|
|
@ -30,8 +30,11 @@ function setupGame() {
|
|||
paused = true;
|
||||
|
||||
score = 0;
|
||||
raspberry = new Raspberry();
|
||||
raspberry.image = RASPBERRY_IMAGE_PATH;
|
||||
hasAlreadyScored = false;
|
||||
raspberry = new Raspberry(RASPBERRY_IMAGE_PATH);
|
||||
|
||||
Obstacle.distanceBetweenPipes = height / 2.5;
|
||||
Obstacle.startX = width;
|
||||
|
||||
// Create all obstacles
|
||||
obstacles = [];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue