This forum is read only and just serves as an archive. If you have any questions, please post them on

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 Jerczu

Define it as a global...

1 decade ago by Nico

Can you be a little more specific?

I've tried defining it as both ig.score,, and, but the value is always undefined in the Game Over screen.


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.


1 decade ago by Nico

Awesome! Thanks, Jerczu. This worked perfectly :)
Page 1 of 1
« first « previous next › last »