vatam icon

Kezdetleges tron

vatam | PRO | 05/14/14 06:34:36 PM UTC | 0 ⭐ | 10775 👁️ | Never ⏰ | []
ActionScript |

1.73 KB

|

None

|

0 👍

/

0 👎

blockSize = 8;
gameHeight = 70;
gameWidth  = 50;
TRON_BLOCK = 1;
keyListener = new Object();
keyListener.onKeyDown = function() {
        var keyCode = Key.getCode();
        if (keyCode > 36 && keyCode < 41) {
                if (game.onEnterFrame != undefined) { 
                      if (keyCode-37 != turnQueue[0]) { 
                                turnQueue.unshift(keyCode-37); 
                      }
        }
        } else if (keyCode == 32) { 
                if (!gameRunning) {
                        startGame();
                }
        }
};
Key.addListener(keyListener);
 
Mouse.addListener(mouseListener);
 function startGame() {
        x = int(gameWidth/2);
        y = gameHeight-2;    
 
        xVelocity = [-1, 0, 1, 0];
        yVelocity = [0, -1, 0, 1];
 
        map = new Array();
        for (var n=0;n<gameWidth;n++) {
                map[n] = new Array();
        }
 
        turnQueue = new Array();
        game.createEmptyMovieClip("s", 2);
 
        tronBlockCounter = 0;
        currentDirection = 1;
 
        game.onEnterFrame = main;
        gameRunning = true;
}
 
function gameOver() {
        delete game.onEnterFrame;
        gameRunning = false;
}
 
function main() {
        if (turnQueue.length > 0) {
                var dir = turnQueue.pop();
                if (dir % 2 != currentDirection % 2) {
                        currentDirection = dir;
                }
        }
        x += xVelocity[currentDirection];
        y += yVelocity[currentDirection];
 
        if (map[x][y] != TRON_BLOCK && x > -1 && x < gameWidth && y > -1 && y < gameHeight) {
                game.s.attachMovie("tronMC", tronBlockCounter, tronBlockCounter, {_x: x*blockSize, _y: y*blockSize});
                tronBlockCounter++;
                map[x][y] = TRON_BLOCK;
        } else {
                gameOver();
        }
}

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  • Cuiznxcn icon
    05/18/26 04:40:22 AM UTC
    text |

    0 B

    |

    0 👍

    /

    0 👎

    Best t33n active cpx link daily updates!
     Copy and paste the link in a new browser tab and then hit enter!
     https://crazyporn.xxx/members/157354/?asgtbndr=1&play=true&spon=adworld&zone=400