Last active
May 7, 2021 06:27
-
-
Save DenverCoder1/f93add6d9e008727b5d70261fd789212 to your computer and use it in GitHub Desktop.
Simple ways to cheat in the chrome://dino game
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Chrome://dino Hacks | |
* Jonah Lawrence | |
* February 2021 | |
* Head to chrome://dino and paste this code in the console to add a couple cheats! | |
* - press 's' to toggle "safe mode" where you can't lose | |
* - press 'p' to add 100 points to your score | |
*/ | |
// toggles a mode where the player is not able to lose from collisions | |
Runner.prototype.toggleSafeMode = () => { | |
// enable safe mode if it is off | |
if (Runner.prototype.gameOver.name) { | |
Runner.prototype.originalGameOver = Runner.prototype.gameOver; | |
Runner.prototype.gameOver = () => {}; | |
} | |
// disable safe mode if it is on | |
else { | |
Runner.prototype.gameOver = Runner.prototype.originalGameOver; | |
} | |
} | |
// Add a given amount to the player's score | |
Runner.prototype.givePoints = (amount) => { | |
Runner.instance_.distanceRan += amount * 40; | |
} | |
document.addEventListener("keypress", (event) => { | |
// press 's' to toggle "safe mode" - you can't lose | |
if (event.key === "s") { | |
Runner.prototype.toggleSafeMode(); | |
} | |
// press 'p' to add 100 points to your score | |
else if (event.key === "p") { | |
Runner.prototype.givePoints(100); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment