File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 8989 < option > Dark Theme by KenyStev</ option >
9090 < option > Green Theme by CoffeeCatDE</ option >
9191 < option > Matrix Theme by Geahad Haymor</ option >
92- < option > Theme by Senura Ratnayake</ option >
92+ < option > Theme by Senura Ratnayake</ option >
9393 </ select >
9494 </ div >
9595 < div style ="display:inline-block;margin-right:10px; ">
9898 < option value ="100 "> Easy</ option >
9999 < option value ="75 " selected > Medium</ option >
100100 < option value ="50 "> Hard</ option >
101+ < option value ="110 "> Rush</ option >
101102 </ select >
102103 </ div >
103104 < button onclick ="go_full_screen() "> Full Screen</ button > < br />
Original file line number Diff line number Diff line change @@ -382,6 +382,16 @@ SNAKE.Snake = SNAKE.Snake || (function() {
382382 return false ;
383383 }
384384
385+ //Checks if the current selected option is that of "Rush"
386+ //If so, "increase" the snake speed
387+ var selectDropDown = document . getElementById ( "selectMode" ) ;
388+ var selectedOption = selectDropDown . options [ selectDropDown . selectedIndex ] ;
389+
390+ if ( selectedOption . text . localeCompare ( "Rush" ) == 0 )
391+ {
392+ snakeSpeed > 30 ? snakeSpeed -= 5 : snakeSpeed = 30 ;
393+ }
394+
385395 return true ;
386396 } ;
387397
@@ -390,6 +400,10 @@ SNAKE.Snake = SNAKE.Snake || (function() {
390400 * @method handleDeath
391401 */
392402 me . handleDeath = function ( ) {
403+ //Reset speed
404+ var selectedSpeed = document . getElementById ( "selectMode" ) . value ;
405+ snakeSpeed = parseInt ( selectedSpeed ) ;
406+
393407 handleEndCondition ( playingBoard . handleDeath ) ;
394408 } ;
395409
You can’t perform that action at this time.
0 commit comments