谷歌浏览器恐龙游戏开挂秘诀

每次打开谷歌浏览器时,我对那个小恐龙无感,只觉得小恐龙是断网的标志。一次别人打开谷歌浏览器,呈现也是令人无感的离线页面。人却在离线页面上,玩起来小恐龙游戏。我当时看到也顿时“真香”!在无意翻看手机时,我居然发现了小恐龙开挂秘诀

永远不gameOver的两行代码

var dino=Runner.prototype

dino.gameOver=()=>{}

获得更多奖励的一行代码

Runner.instance_.setSpeed(数值)

var dino=Runner.prototype此语句创建一个游戏线程类,线程类中有一个方法叫gameOver函数。

dino.gameOver=()=>{}此语句令整个gameOver函数变为没有任何语句的空函数。gameOver函数名存实亡,一直保持玩家开始游戏的界面。

gameOver: function() {

    this.playSound(this.soundFx.HIT);

    vibrate(200);

    this.stop();

    this.crashed = true;

    this.distanceMeter.achievement = false;

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

    // Game over panel.

    if (!this.gameOverPanel) {

      if (this.canvas) {

        this.gameOverPanel = new GameOverPanel(this.canvas,

            this.spriteDef.TEXT_SPRITE, this.spriteDef.RESTART,

            this.dimensions);

      }

    } else {

      this.gameOverPanel.draw();

    }


    // Update the high score.

    if (this.distanceRan > this.highestScore) {

      this.saveHighScore(this.distanceRan);

    }


    // Reset the time clock.

    this.time = getTimeStamp();

  }



 setSpeed函数是控制手机端和电脑端恐龙跑的速度。函数中if语句段是对手机的适配。若不对手机适配,手机界面里的恐龙那就说不好飞到哪里去了。else if语句段是对电脑适配。Runner.instance_.setSpeed(100)中数值100会传入opt_speed变量,再进入setSpeed函数中,恐龙移动速度100(单位,我没弄明白说不好)

setSpeed: function(opt_speed) {

    const speed = opt_speed || this.currentSpeed;

    // Reduce the speed on smaller mobile screens.

    if (this.dimensions.WIDTH < DEFAULT_WIDTH) {

      const mobileSpeed = speed * this.dimensions.WIDTH / DEFAULT_WIDTH *

          this.config.MOBILE_SPEED_COEFFICIENT;

      this.currentSpeed = mobileSpeed > speed ? speed : mobileSpeed;

    } else if (opt_speed) {

      this.currentSpeed = opt_speed;

    }

  }

拓展阅读

谷歌小恐龙修改无敌刷分  https://blog.csdn.net/qq_19659617/article/details/104009452

google chrome浏览器离线小恐龙游戏刷分bug  https://blog.csdn.net/z_qifa/article/details/74202863

参考博文:

谷歌浏览器留下的彩蛋 “恐龙越障碍”小游戏  https://blog.csdn.net/qq_43901693/article/details/104092009

js(=>) 箭头函数 详细解说 案例大全  https://www.cnblogs.com/hailun/p/6279029.html

js中[]、{}、()区别  https://www.cnblogs.com/mike-mei/p/11194138.html

看看程序员是怎么玩游戏的  https://mp.weixin.qq.com/s/WGDUyyenjKC7yiWloPBHbw


版权声明:本文为qq_34674558原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。