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

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

永远不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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值