Jump to content

Super Noob: My code will broke in Game stage


Recommended Posts


I'm very new in HTML5 and Phaser so I learn from different tutorials but now i wanted to make a small game where I combine 2 tutorials. But I have an error at a 'for', I know that because if i comment that section, the "game" will continue running. I don't have any graphics until now because the first I wanted to make my code work in all stages: preloader, index, game, gameover, etc.

You will see that i have some buttons wherewith i move from one stage to another. If i decomment 1 and 2, I can't move from stage to stage because my game will broke. But if I comment those line, all it's good. You will see in the images.

1.for(var i=1;i<5;i++){
            for(var j=1;j<=3;j++){


2.for(var i=0;i<3;i++){
            var numberButton = this.game.add.button(50,250+i*75,"buttons",checkAnswer,this).frame=i;
        numberTimer =  this.game.add.sprite(50,250,"timebar");


Please tell me if I have to upload the project with all the files. Thanks! :)


Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...