1 decade ago by LadyEmrys
Hi!
I've been trying to create a super simple kids game where the character doesn't really die, but am having lots of trouble getting the game over screen to load. I bought Jesse Freeman's book but wasn't able to get the game over code to work at all, even when i put a kill entity at the end that "should" trigger the game over screen. i'm super new to game programming, so kindly forgive my ignorance!
I have in my main.js:
MyGame = ig.Game.extend({
font: new ig.Font( 'media/04b03.font.png' ),
gravity: 400,
lives: 1,
and have tried to put in a game over function:
gameOver: function(){
ig.system.setGame(GameOverScreen);
In my player entity:
kill: function(){
this.parent();
},
onDeath: function(){
ig.game.lives --;
if(ig.game.lives < 0){
ig.game.gameOver();
//this.parent();
}},
but it doesn't do anything. Does anyone have any ideas on how i could make this work? Thanks so very much!
LE
I've been trying to create a super simple kids game where the character doesn't really die, but am having lots of trouble getting the game over screen to load. I bought Jesse Freeman's book but wasn't able to get the game over code to work at all, even when i put a kill entity at the end that "should" trigger the game over screen. i'm super new to game programming, so kindly forgive my ignorance!
I have in my main.js:
MyGame = ig.Game.extend({
font: new ig.Font( 'media/04b03.font.png' ),
gravity: 400,
lives: 1,
and have tried to put in a game over function:
gameOver: function(){
ig.system.setGame(GameOverScreen);
In my player entity:
kill: function(){
this.parent();
},
onDeath: function(){
ig.game.lives --;
if(ig.game.lives < 0){
ig.game.gameOver();
//this.parent();
}},
but it doesn't do anything. Does anyone have any ideas on how i could make this work? Thanks so very much!
LE