1 decade ago
by Nico
As the title says.
How do I do this? For example pass the score variable to a game over screen, or something similar.
Any help would be great!
1 decade ago
by Nico
Can you be a little more specific?
I've tried defining it as both ig.score, ig.global.score, and ig.game.score, but the value is always undefined in the Game Over screen.
Thanks!
1 decade ago
by Jerczu
Because game over screen is probably a different class... Its actually very simple to define it.
In your main js go just before your line initiating canvas here's a snippet from one of my games.
var gameScore = 0;
ig.main( '#canvas', MyGame, 60, 480, 320, 1 );
And then during game you can access any of these - so if you add to score in your game class each time you die do gameScore = scoreFromYourGameClass.
Then in your game over screen print it calling gameScore.
Simple.
1 decade ago
by Nico
Awesome! Thanks, Jerczu. This worked perfectly :)
Page 1 of 1
« first
« previous
next ›
last »