恐龙游戏破解不起作用

问题描述 投票:0回答:3

我正在为谷歌恐龙游戏做这个黑客:

function speed(n) {
    Runner.instance_.setSpeed(n);
}

function noHit() {
    Runner.prototype.gameOver = function() {
        console.log("");
    }
}

function notNoHit() {
    Runner.prototype.gameOver = function() {
        this.playSound(this.soundFx.HIT);
        vibrate(200);

        this.stop();
        this.crashed = true;
        this.distanceMeter.acheivement = false;

        this.tRex.update(100, Trex.status.CRASHED);
    }
}

它应该被输入到控制台中,这样你就不必编辑页面的 html,这相当复杂(至少对我来说)。所以,当我输入它时,它返回 undefined , 照常。当我使用速度(n)时,它将速度设置为n。当我使用 noHit() 时,它会使我不会被击中。当我说 notNoHit() 时,它像往常一样返回 undefined ,但是当我击中仙人掌时,它会给我一个错误:

Uncaught RefrenceError: vibrate is not defined
    at Runner.gameOver (<anonymous>:14:3)
    at Runner.update (data:text/html,chromewebdata:2005)

这有点让我惊讶,因为我没有NoHit()的方法是简单地将函数设置回原来的样子,而不是垃圾命令,(console.log("");)所以我不太确定如何解决这个问题。

javascript console
3个回答
0
投票

打开 Chrome 浏览器的控制台,编写以下代码,它对我来说工作正常。

Runner.instance_.gameOver=()=>{}


0
投票

尝试这个代码,当恐龙靠近障碍物时,它会自动跳跃

Runner.instance_.gameOver = function () { 
 this.playSound ( this.soundFx.HIT);
 vibrate(500);

 this.crashed = false;
 //this.tRex.endJump ();
 this.tRex.startJump (200);
// console.log  (this.tRex)
}

0
投票

您还可以使用

Runner.prototype.gameOver=()=>{}
谷歌发布了新版本的恐龙游戏。

© www.soinside.com 2019 - 2024. All rights reserved.