Simple high-score question

La publicación #1 de Creampie está oculta porque este usuario está banneado. mostrar

Creampie dijo

hace mucho tiempo | Publicación #1
Ok, check it out.. I'm new at actionscript, so bare with me..

Basic layout of my Flash:

Frame 1: Title Screen
Frame 2: Game
Frame 3: Ending screen with score


On Frame 3, I have the following code. I'm sure theres a far better way of doing this, but basically I have it set so when the Flash reaches frame 3, it executes the NonobaAPI code and sends the high score.

_root.createEmptyMovieClip("watcher", _root.getNextHighestDepth());
_root.watcher.onEnterFrame = function() {
if (currentFrame == 3) {
NonobaAPI.SubmitScore("myscore1", score, highscore_callback);
_root.watcher.removeMovieClip();
}
}


Frame 2 has this code (I'm attempting to reset the score..):
score=0;



The Problem:
When I play the game the 1st time, it works and submits the score.
When I press the 'Play Again' button (which just sends you back to Frame 2 to play again), it works fine on the 2nd time and submits the score.
The 3rd time I try and play it though, it won't submit the score. I have to refresh the page and play again in order to submit any scores.

How can I truly reset the game score when moving back to another frame?


Thanks :)

404404 dijo

hace mucho tiempo | Publicación #2
I'm not sure from your description what your problem might actually be. It sounds like most everything should work...

I would, however, not use the createMovie/removeMovie code you're using for the submit score function.

Just take the line
NonobaAPI.SubmitScore("myscore1", score, highscore_callback);
and put it on the third frame outside of an enterFrame, like you would when declaring a variable.

That may or may not actually solve your problem, it's hard to say.

Contestar al tema

Regístrate ahora para responder a éste tema

Juegamigo

juegamigo.com es un sitio de juegos independiente donde puedes jugar solo o en conjunto en los juegos multijugador de una manera gratuita.

Herramientas para Desarrolladores

Si eres un desarrollador de juegos flash, tenemos unas increíbles herramientas que te ayudarán a hacer aún mejores tus juegos.

Juegos Padrísimos

¿Por qué no jugar algunos de los mejores juegos flash en línea que tenemos?, ¡es completamente gratis!

Copyright ©2007-2012 Juegamigo™ - All rights reserved.46.8001ms on SERVER34096