File tree 1 file changed +7
-4
lines changed
1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -259,7 +259,7 @@ function pillEaten() {
259
259
setTimeout ( function ( ) {
260
260
ghosts . forEach ( ghost => ghost . scared = true ) ;
261
261
time = 11 ;
262
- timer ( time ) ; } , 120 ) ;
262
+ timer ( time ) ; } , 12 ) ;
263
263
squares [ pacCurrent ] . classList . remove ( 'pill' ) ;
264
264
foodCount -- ;
265
265
}
@@ -293,21 +293,23 @@ function checkForWin() {
293
293
ghosts . forEach ( ghost => clearInterval ( ghost . ID ) ) ;
294
294
document . removeEventListener ( 'keydown' , movePacman ) ;
295
295
document . getElementById ( 'something' ) . classList . add ( 'win' ) ;
296
+ time = 0 ;
296
297
setTimeout ( levelup , 3000 ) ;
297
298
flag = 1 ;
298
299
}
299
300
}
300
301
function timer ( o ) {
301
- let timeDisplay = 10 * o - 1 ;
302
+ let timeDisplay = 100 * o - 1 ;
302
303
let id = setInterval ( function ( ) {
303
304
if ( timeDisplay == 0 || time == 0 ) {
304
305
ghosts . forEach ( ghost => ghost . scared = false ) ;
305
306
flag = 0 ;
306
307
time = 0 ;
308
+ document . getElementById ( 'time' ) . innerHTML = 0 ;
307
309
clearInterval ( id ) ; }
308
- document . getElementById ( 'time' ) . innerHTML = Math . floor ( timeDisplay / 10 ) ;
310
+ document . getElementById ( 'time' ) . innerHTML = Math . floor ( timeDisplay / 100 ) ;
309
311
timeDisplay -= 1 ;
310
- } , 100 ) ;
312
+ } , 10 ) ;
311
313
}
312
314
function scoreD ( ) {
313
315
document . getElementById ( 'score' ) . innerHTML = score ;
@@ -318,6 +320,7 @@ function levelup(){
318
320
levelCurrent ++ ;
319
321
level ( document . getElementById ( 'b1' ) ) ;
320
322
document . getElementById ( 'something' ) . classList . remove ( 'win' ) ;
323
+ document . getElementById ( 'time' ) . innerHTML = 0 ;
321
324
score = 0 ;
322
325
scoreD ( ) ;
323
326
if ( lives < 5 ) {
You can’t perform that action at this time.
0 commit comments