📜  google dino hack - Javascript (1)

📅  最后修改于: 2023-12-03 15:01:02.798000             🧑  作者: Mango

Google Dino Hack - JavaScript

Google Chrome's offline game, Dinosaur Game, is a fun and simple game to play when you don't have internet available. However, did you know that there are ways to hack the game and take your high score to the next level? In this article, we'll explore some JavaScript hacks that can help you achieve a higher score in Google's Dinosaur Game.

The Basics

To play the Dinosaur Game, all you need to do is open up Google Chrome and disconnect your internet connection. A message will appear on the screen saying "Unable to connect to the internet." At this point, simply press the space bar to start the game.

The game involves running, jumping, and dodging obstacles. Your score increases the longer you survive.

Hacks
No Obstacles

The first hack we'll look at is a simple one that removes all the obstacles from the game. To do this, open up the browser console (press F12) and enter the following code:

var original = Runner.prototype.gameOver
Runner.prototype.gameOver = function(){}

With this code in place, you can now play the game without any obstacles. This can help you achieve a high score quickly, but it also takes away the fun of the game.

Immortality

Another hack you can try is making your dinosaur immortal. To do this, enter the following code in the console:

var original = Runner.prototype.gameOver
Runner.prototype.gameOver = function(){}
var original1 = Runner.prototype.gameOver
Runner.prototype.gameOver = function(){original();}

With this code in place, your dinosaur will not die when it hits an obstacle. However, your score will not increase as you cannot die.

Speed Up

If you want to add some challenge to the game, you can speed it up. To do this, enter the following code in the console:

var FPS=60, original=setInterval;
setInterval = function(fn,ms){ return original(fn, 1000/FPS); }

With this code in place, the game will run at 60 frames per second instead of the current speed. This can make the game much more difficult as the obstacles come at you much faster.

Score Multiplier

Finally, if you want to add some fun to the game, you can increase your score multiplier. To do this, enter the following code in the console:

var scoreEl = document.querySelector('.score-container .score-achievement'),
    score = 0;
Object.defineProperty(window,'score',{get:function(){ return score; },set:function(val){ score=val; scoreEl.innerHTML = score; }});

With this code in place, your score multiplier will increase as you play the game. This can help you achieve a higher score than you normally would.

Conclusion

With these simple JavaScript hacks, you can take your Dinosaur Game high score to the next level. However, it's important to remember that these hacks take away the fun of the game. It's always better to play the game the way it was intended to be played.