StephenDunne Posted February 17, 2015 Share Posted February 17, 2015 In the game im making, I have 2 separate html files, a level 1 and a level 2. Once I complete level 1 I want it to run level 2. Once the level is completed an image pops up says that the level is completed. I want the next level to load when the user clicks on this image. How would I go about this? This is the code I have. function rightAnswer (num1, ground1) {wellDone = game.add.sprite(200,100, 'wellDone');score += 1;scoreText.text = scoreString + score;num1.kill();ship.kill();cloud.kill();game.state.start('level2', AirQuation.level2);} Link to comment Share on other sites More sharing options...
ptdnet Posted February 17, 2015 Share Posted February 17, 2015 window.location.assign("somePage.html") Link to comment Share on other sites More sharing options...
Rorian Posted February 17, 2015 Share Posted February 17, 2015 The thing is you should not separate your game into more HTML files. The HTML file is used only as a starting point so your browser can load javascript and create a Canvas. Everything game related should be done in the javascript on the same Canvas. valueerror 1 Link to comment Share on other sites More sharing options...
StephenDunne Posted February 18, 2015 Author Share Posted February 18, 2015 Thanks lads Link to comment Share on other sites More sharing options...
beuleal Posted February 19, 2015 Share Posted February 19, 2015 I recommend u use states than html page files Link to comment Share on other sites More sharing options...
Recommended Posts