Send scorre, til gameover.php, som post
Er der nogle der kan lave så, at når man er "gameover" bliver man sendt til siden gameover.php og en scorre bliver sendt med, som post? altså ikke til gameover.php?scorre=34 men som post, så det ikke kan ses? På den her kode:blockSize = 8;
gameHeight = 30;
gameWidth = 45;
SNAKE_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();
}
} else if (keyCode == 80) {
if (gameRunning) {
if (game.onEnterFrame) {
delete game.onEnterFrame;
textMC.gotoAndStop("paused");
} else {
game.onEnterFrame = main;
textMC.gotoAndStop("hide");
}
}
}
};
Key.addListener(keyListener);
mouseListener = new Object();
mouseListener.onMouseDown = function() {
if (!gameRunning) {
startGame();
}
};
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("food", 1);
game.createEmptyMovieClip("s", 2);
scoreTextField.text = "Score: 0";
foodCounter = 0;
snakeBlockCounter = 0;
currentDirection = 1;
snakeEraseCounter = -1;
score = 0;
placeFood("new");
textMC.gotoAndStop("hide");
game.onEnterFrame = main;
gameRunning = true;
}
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] != SNAKE_BLOCK && x > -1 && x < gameWidth && y > -1 && y < gameHeight) {
game.s.attachMovie("snakeMC", snakeBlockCounter, snakeBlockCounter, {_x: x*blockSize, _y: y*blockSize});
snakeBlockCounter++;
if (typeof(map[x][y]) == "movieclip") {
score += 10;
scoreTextField.text = "Score: " + score;
snakeEraseCounter -= 5;
placeFood(map[x][y]);
}
map[x][y] = SNAKE_BLOCK;
var tailMC = game.s[snakeEraseCounter];
if (tailMC) {
delete map[tailMC._x/blockSize][tailMC._y/blockSize];
tailMC.removeMovieClip();
}
snakeEraseCounter++;
} else {
gameOver();
}
}
function gameOver() {
textMC.gotoAndStop("gameOver");
delete game.onEnterFrame;
gameRunning = false;
}
function placeFood(foodMC) {
do {
var xFood = random(gameWidth);
var yFood = random(gameHeight);
} while (map[xFood][yFood]);
if (foodMC == "new") {
foodMC = game.food.attachMovie("foodMC", foodCounter, foodCounter);
foodCounter++;
}
foodMC._x = xFood*blockSize;
foodMC._y = yFood*blockSize;
map[xFood][yFood] = foodMC;
}