Skip to content

Instantly share code, notes, and snippets.

@michelefenu
Last active February 18, 2022 08:02
Show Gist options
  • Save michelefenu/4dd6cbf987196346a3f2477efd5fba91 to your computer and use it in GitHub Desktop.
Save michelefenu/4dd6cbf987196346a3f2477efd5fba91 to your computer and use it in GitHub Desktop.
Chrome tRex autojump
const autoJump = () => {
const instance = window.Runner.instance_;
const dino = instance.tRex;
const nextObstacle = instance.horizon.obstacles.filter(
(x) => x.xPos > dino.xPos
)[0];
if (nextObstacle && nextObstacle.xPos - dino.xPos < 120) {
dino.startJump(100);
}
requestAnimationFrame(autoJump);
};
requestAnimationFrame(autoJump);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment