Google Chrome small dinosaur code (auto jump, high jump, invincible, acceleration)

Table of contents

Automatic code jump

invincible code

High jump code (you can change the parameters in the brackets)

Sprint code (parameters in brackets can be changed)


Most browsers have their own easter eggs, and today we are sharing Google Chrome

Google Dinosaur Game is a small game that comes with the browser.
You can play even when disconnected from the internet
, so how to play the game while connected to the internet?

First open Google Chrome, enter in the address bar: chrome://dino/

open whole


Automatic jump code:

function TrexRunnerBot() {

 const makeKeyArgs = (keyCode) => {

 const preventDefault = () => void 0; return {keyCode, preventDefault}; };

 const upKeyArgs = makeKeyArgs(38); const downKeyArgs = makeKeyArgs(40); const startArgs = makeKeyArgs(32);

 if (!Runner().playing) {

 Runner().onKeyDown(startArgs); setTimeout(() => {

 Runner().onKeyUp(startArgs); }, 500); }

 function conquerTheGame() {

 if (!Runner || !Runner().horizon.obstacles[0]) return;

 const obstacle = Runner().horizon.obstacles[0];

 if (obstacle.typeConfig && obstacle.typeConfig.type === 'SNACK') return;

 if (needsToTackle(obstacle) && closeEnoughToTackle(obstacle)) tackle(obstacle); }

 function needsToTackle(obstacle) {

 return obstacle.yPos !== 50; }

 function closeEnoughToTackle(obstacle) {

 return obstacle.xPos <= Runner().currentSpeed * 18; }

 function tackle(obstacle) {

 if (isDuckable(obstacle)) {

 duck(); } else {

 jumpOver(obstacle); }

 }

 function isDuckable(obstacle) {

 return obstacle.yPos == 75; }

 function duck() {

 drop(); Runner().onKeyDown(downKeyArgs);

 setTimeout(() => {

 Runner().onKeyUp(downKeyArgs); }, 500); }

 function drop() {

 Runner().onKeyDown(downKeyArgs);

 Runner().onKeyUp(downKeyArgs); }

 function jumpOver(obstacle) {

 if (isNextObstacleCloseTo(obstacle))

 jumpFast(); else

 Runner().onKeyDown(upKeyArgs); }

 function isNextObstacleCloseTo(currentObstacle) {

 const nextObstacle = Runner().horizon.obstacles[1];

 return nextObstacle && nextObstacle.xPos - currentObstacle.xPos <=

Runner().currentSpeed * 42; }

 function jumpFast() {

 Runner().onKeyDown(upKeyArgs); Runner().onKeyUp(upKeyArgs); }

 return {conquerTheGame: conquerTheGame}; }

let bot = TrexRunnerBot(); let botInterval = setInterval(bot.conquerTheGame, 2);

Invincible code:

Runner.instance_.gameOver=function(){} 

High jump code (parameters in brackets can be changed):

Runner.instance_.tRex.setJumpVelocity(20)

Sprint code (parameters in brackets can be changed):

Runner.instance_.setSpeed(50) 

Do you understand? If you have any questions, please comment in the comment area~

Show off to others in the information class

Guess you like

Origin blog.csdn.net/Oct10_traitor/article/details/128285387