Created
August 13, 2016 07:24
-
-
Save HelloWorld017/ba97a39c94d002896555cd613b7545d4 to your computer and use it in GitHub Desktop.
Chrome Offline tRex game nightmode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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