Hack For Dino Run Game
Hack For Dino Run Game
We store the original game over function in a variable. This step is IMPORTANT if
you want to stop the game later and needs to be done before you reset the gameOver
function.
Runner.prototype.gameOver = function(){}
How to stop?
When you want to stop the game, Revert back to the original game over function.
This would only work if you had entered both commands in order for Immortality.
Runner.prototype.gameOver = original
Tweaking Speed
Type the following command in Console and press enter. You can use any other speed
in place of 1000.
Runner.instance_.setSpeed(1000)
To go back to normal speed:
Runner.instance_.setSpeed(10)
Jumping height
You can control how high the dino jumps by using the below function. Adjust the
value as necessary.
Runner.instance_.tRex.setJumpVelocity(10)
Walk in air
Chrome Dino walking in air
Runner.instance_.tRex.groundYPos = 0
Back to ground:
Runner.instance_.tRex.groundYPos = 93
Auto-play
This code periodically checks for the closest obstacle (cactus or pterodactyl) and
then jumps or ducks based on the obstacle’s position.
if (obstacle) {
const w = obstacle.width
const x = obstacle.xPos // measured from left of canvas
const y = obstacle.yPos // measured from top of canvas
const yFromBottom = CANVAS_HEIGHT - y - obstacle.typeConfig.height
const isObstacleNearby = x < 25 * speed - w / 2
if (isObstacleNearby) {
if (yFromBottom > DINO_HEIGHT) {
// Pterodactyl going from above, do nothing
} else if (y > CANVAS_HEIGHT / 2) {
// Jump
dispatchKey("keyup", KEY_CODE_ARROW_DOWN)
dispatchKey("keydown", KEY_CODE_SPACE_BAR)
} else {
// Duck
dispatchKey("keydown", KEY_CODE_ARROW_DOWN)
}
}
}
}, Runner.instance_.msPerFrame);