Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- javascript:(function(){
- var goUp = function(){Ω.input.lastKey=window.game.screen.bird.curWord[window.game.screen.bird.curIdx].charCodeAt(0);window.game.screen.bird.tick();};
- window.first_loop = true;
- window.loop_id = setInterval(function(){
- if (window.first_loop) {
- goUp();
- window.first_loop = false;
- }
- var bird = window.game.screen.bird;
- var pipes = window.game.screen.pipes;
- var nearestUp, nearestDown, nearestX = 10000000;
- for(var i = 0; i < pipes.length; i++) {
- var p = pipes[i];
- if (p.x > bird.x - 48 && p.x <= nearestX) {
- nearestX = p.x;
- if (p.dir == 'down') {
- nearestDown = p;
- } else {
- nearestUp = p;
- }
- }
- }
- var lowerBound = nearestUp.y;
- var upperBound = nearestDown.y + 320;
- if (bird.y + 40 > lowerBound) {
- goUp();
- }
- }, 10);
- window.onkeydown = function(e) {
- var code = e.keycode ? e.keyCode : e.which;
- if (code === " ".charCodeAt(0)) {
- clearInterval(window.loop_id);
- }
- };
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement