i tried looking for a restart function in ig.game and ig.system, but there doesn't seem to be one.
any ideas how to call a restart?
I basically need to call it after the end credits of the game has finished showing....
after some thinking, here's how I did it, without using a restart method:
// main.js
run:function(){
if(this.mode==MyGame.MODE.GAME){
this.update();
this.draw();
}
else if(this.mode==MyGame.MODE.SPLASH){
this.showSplash();
}
else if(this.mode==MyGame.MODE.CREDITS){
this.showCredits();
}
},
showCredits:function(){
if(ig.input.pressed('shoot')||ig.input.pressed('jump')){
// goto splash screen
this.mode=ig.GAME.MODE.SPLASH;
return;
}
ig.system.clear(this.clearColor);
this.font.draw('Credits....',ig.system.width/2,ig.system.height/2);
},
showSplash:function(){
if(ig.input.pressed('shoot')||ig.input.pressed('jump')){
this.loadLevel(this.nextLevel);
return;
}
},
Page 1 of 1
« first
« previous
next ›
last »