'Globals', Get it away from me!

Hi everyone.

I’ve reached a point in my game where i need to consult people whom are knowledgable about Globals, but first my goal.

I have levels and a level select screen.
Every level has 3 stars, upon completion, depending how many you got will be displayed on the level select screen.

So far i have a variable local starsCollected = 0 on each level.
Everytime you collect one it increases until you get 3.

My plan was to save this number and place the corrosponding stars on the level select screen.

What is the best way to go about this, for effiency for mass levels?

I can only think about using Global Variables, so i could set them in the level and read them in the select screen, but this would require 1 global variable per level, which would turn into 90+ by the end.
Although there would only be 1 per level and no collision or timers are related to them.
But i heard Globals are Bad M’Kay…
What about a Global table, is that more efficient?

Probably best to keep a Global Variable Module to keep things organised too.

So, what would be the best way for me to go about this?
:slight_smile:
[import]uid: 91798 topic_id: 17627 reply_id: 317627[/import]

Have you considered using something like ice to save the info? (I mean, I guess you wont be clearing the stars every launch?)

http://developer.anscamobile.com/code/ice

You are correct in thinking globals should be avoided wherever possible and certainly 90+ globals would be very, very bad.

Is ice a possible solution here?

Peach :slight_smile: [import]uid: 52491 topic_id: 17627 reply_id: 67116[/import]

You’d be correct, stars stay as they are.
Like most games.

I’ll have a look at this ice, it seems to be what I want from the looks of it.
I’d be able to save a variable(or icebox) in a lvl an read it from level select?
Hopefully I find it easy to use.
Looks easy.

I’ll report back later tonight when I’ve had abgo with it.
Thanks. [import]uid: 91798 topic_id: 17627 reply_id: 67141[/import]

I look forward to hearing how it goes :slight_smile:

(Ice was created by Graham Ranson, the fellow behind Lime - so you know it’s good!)

Peach :slight_smile: [import]uid: 52491 topic_id: 17627 reply_id: 67229[/import]