by jestanoff · 6y ago · 0 comments
setInterval(() => {
const { currentSpeed, horizon: { obstacles: [{ xPos, width, yPos } = {}] } } = Runner?.instance_;
if (xPos < 25 * currentSpeed - width && yPos >= 75)
document.dispatchEvent(new KeyboardEvent('keydown', { keyCode: 32 }));
}, 100);So, I think the code I mentioned in the article is more efficient.
Essentially this is the same solution as in the post, just stripped down to the bare minimum of code, but I haven't tested it enough. There must be some edge case that it fails on