Skip to content

Instantly share code, notes, and snippets.

@DenverCoder1
Last active May 7, 2021 06:27
Show Gist options
  • Save DenverCoder1/f93add6d9e008727b5d70261fd789212 to your computer and use it in GitHub Desktop.
Save DenverCoder1/f93add6d9e008727b5d70261fd789212 to your computer and use it in GitHub Desktop.
Simple ways to cheat in the chrome://dino game
/* 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