Skip to content

Instantly share code, notes, and snippets.

@HelloWorld017
Created August 13, 2016 07:24
Show Gist options
  • Save HelloWorld017/ba97a39c94d002896555cd613b7545d4 to your computer and use it in GitHub Desktop.
Save HelloWorld017/ba97a39c94d002896555cd613b7545d4 to your computer and use it in GitHub Desktop.
Chrome Offline tRex game nightmode
'use strict';
var tRex = Runner.instance_.tRex;
tRex.direction = 1;
var move = function move() {
tRex.xPos = Math.max(Math.min(tRex.xPos + tRex.direction * 5, 500), 0);
};
window.onkeydown = function (e) {
if (e.key === 'ArrowRight') tRex.direction = 1;
if (e.key === 'ArrowLeft') tRex.direction = -1;
};
var nightmode = function nightmode() {
Runner.instance_.config.INVERT_DISTANCE = 0;
Runner.instance_.config.MAX_OBSTACLE_LENGTH = 4;
Runner.instance_.config.SPEED = 13;
setInterval(move, 25);
};
nightmode();
//Open Developer Console (f12) and enter this code. Then, the nightmode will be enabled.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment