谷歌浏览器Chrome小恐龙游戏魔改代码

打开谷歌浏览器Chrome并进入游戏

  • 断网状态下直接按空格键进入游戏
  • 联网状态下访问网址chrome://dino

 

按F12进入开发者模式,选择控制器Console

 

 

在Console输入以下代码并按下回车Enter后生效

 

无敌模式

Runner.instance_.gameOver=function(){};

 

速度设置为10

Runner.instance_.setSpeed(10);

 

自动跳跃

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 === 50; } function duck() { Runner().onKeyDown(downKeyArgs); setTimeout(() => { Runner().onKeyUp(downKeyArgs); }, 500); } 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);

 

posted @ 2022-09-29 12:29  淡淡的晓山横雾  阅读(4960)  评论(0编辑  收藏  举报