Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

brunaasis

Redirecionar para página após passar de level

Recommended Posts

Olá tô com um problemão que talvez seja fácil pra vcs...

Estou modificando um joguinho Html5 e js porém preciso fazer uma modificação que já tentei

de todas as formas e ainda não consegui...

O jogo após chegar no Level 3 ( O máximo) retorna para o level 0

gostaria de que quando passasse do level 3 o sistema redirecionasse pra uma página qualquer...

 

Alguém poderia me ajudar?

 

download do código: http://david.blob.core.windows.net/html5platformer/PlatformerTouch.zip

Compartilhar este post


Link para o post
Compartilhar em outros sites

adicione esse codigo abaixo da linha 299 do arquivo src/easejs/PlataformGame.js no metodo HandlerInput como exemplo ele redirecionou para uma pagina do google apos ser comtabilizado a trasição de tela igual a 4

var aux = this.levelIndex; 
	if((aux + 1) == 4){
	window.location.href = 'http://www.google.com.br';
}

abaixo o codigo do metodo inteiro

PlatformerGame.prototype.HandleInput = function () {
        if (!this.wasContinuePressed && this.continuePressed) {
            if (!this.level.Hero.IsAlive) {
                this.level.StartNewLife();
                this.platformerGameStage.removeChild(statusBitmap);
                overlayDisplayed = false;
            }
            else if (this.level.TimeRemaining == 0) {
                if (this.level.ReachedExit) {
                    // If CSS3 Transitions is supported
                    // We're using smooth & nice effects between each levels
                    if (Modernizr.csstransitions) {
                        this.loadNextLevel = true;
						var aux = this.levelIndex; 
						if((aux + 1) == 4){
							window.location.href = 'http://www.google.com.br';
						}
                        // Setting the moveRotation class will trigger the css transition
                        this.platformerGameStage.canvas.className = "moveRotation";
                    }
                        // If CSS3 Transition is not supported, we're jumping directly
                        // to the next level
                    else {
                        this.LoadNextLevel();
                    }
                }
                else
                    this.ReloadCurrentLevel();
            }
        }

        this.wasContinuePressed = this.continuePressed;
    };

espero que isso ajude!

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.