I'm trying to code a game, to do this I need to recall functions until the players lose.
Just something like this.
class Game{
init(){
//init game
if(!this.gameOver())
this.lunch();
}
lunch(){
//init pieces of the game
this.refreshCanvas();
}
refreshCanvas(){
//refreshing frames of the game
if(!this.isFloorTouched()){
this.lunch(); // ---> When i do this nothing work anymore "Maximum call stack size exceeded"
}
}
}