Open online-Google Dino Games

Insert picture description here
Have you ever encountered the above situation?
Then press the space bar to start the game

However, every time the game fails, it will start from the origin and slow down,
then, is there any way to stop us from starting at the original speed?


Yes , open online . The code of this small game that appeared after Google dropped is written by the front-end js. Its programming idea is mainly based on objects. We mainly look for this file:
Insert picture description here
look down, until these lines of code:
Insert picture description here
through the above Code, it can be seen that this is the use of js objects to control the game parameters, because js can be exposed in the browser, we can directly modify the code, debug small dinosaur game parameters
ignore the obstacles, the score can be swept :
Then enter this statement in the console>
Runner.instance_.gameOver = function(){}

The demo is as follows:

Now
let 's introduce some practical properties: enter Runner.config in the console, you can see the following content, these are the properties that control the game

Runner.config.SPEED is to set the running speed of the little dinosaur, the game initialization default is 6
Insert picture description here

We changed it to 15, the speed takeoff is comparable to the famous mountain bike god:
Runner.config.SPEED = 15
Insert picture description here

List of related game settings, you can modify it yourself to see more game effects

ACCELERATION: 0.001

----加速度:0.001

ARCADE_MODE_INITIAL_TOP_POSITION: 35

----拱廊模式初始位置:35

ARCADE_MODE_TOP_POSITION_PERCENT: 0.1

----拱廊模式顶部位置百分比:0.1

BG_CLOUD_SPEED: 0.2

----背景云速度:0.2

BOTTOM_PAD: 10

----下垫:10

CANVAS_IN_VIEW_OFFSET: -10

----画布视图偏移量:-10

CLEAR_TIME: 3000

----清除时间:3000

CLOUD_FREQUENCY: 0.5

----云频率:0.5

GAMEOVER_CLEAR_TIME: 750

----游戏结束时间:750

GAP_COEFFICIENT: 0.6

----间隙系数:0.6

GRAVITY: 0.6

----重力:0.6

INITIAL_JUMP_VELOCITY: 12

----初始跳跃速度:12

INVERT_DISTANCE: 700

----反转距离:700

INVERT_FADE_DURATION: 12000

----反转淡入时间:12000

MAX_BLINK_COUNT: 3

----最大闪烁次数:3

MAX_CLOUDS: 6

----最大云数:6

MAX_OBSTACLE_DUPLICATION: 2

----最大障碍重复次数:2

MAX_OBSTACLE_LENGTH: 3

----最大障碍物长度:3

MAX_SPEED: 13

----最大速度:13

MIN_JUMP_HEIGHT: 35

----最小跳跃高度:35

MOBILE_SPEED_COEFFICIENT: 1.2

----移动速度系数:1.2

RESOURCE_TEMPLATE_ID: "audio-resources"

----resource_template_id:“音频资源”

SPEED: 6

----速度:6

SPEED_DROP_COEFFICIENT: 3

----速度下降系数:3

By the way, how to bring up dinosaurs in online mode?
Enter this paragraph in the url field: the
chrome://dino/
little dinosaur came out.

The demo is for learning and communication.


Insert picture description here

Published 20 original articles · Liked 19 · Visitors 4868

Guess you like

Origin blog.csdn.net/qq_41136216/article/details/105533252