I've seen a number of people mentioning using Globals for storage and saving level data etc.
Is it not better (practice) to create arrays and use them, something like this?
You need two arrays one for your user data one for the level data.
1 2 3 4 [Userid]
Tim Tom Jim Jon [Playername]
1 1 2 3 [Difficulty]
Off Off 25 75 [Music volume]
On On Off On [WebGL]
On Off On Off [Particles]
Red Blue Green Yellow [Favourite colour] etc etc.
You will need to collect this data and these preferences to populate the array
Something like a 6 X 8 X 1 would allow you to really let the player customise their game settings.
(You did notice that doing it this way immediately introduces the age old concept of multiple game slots didn't you?)
Create a "Load Game/New Game" Layout.
Populate the load slots with the relevant usernames from the array and make them clickable linking to control panel page.
If total num slots > number players already registered
then make visible a new player textbox. Tip ->(Player chooses name but system allocates Playerid on submit) <img src="smileys/smiley2.gif" border="0" align="middle" />
Both options (existing and new)should divert to control panel page for user to select their preferences. Set it up so exiting the cp will store Userdata collected thus far use Playername for individual saveslot.
You now have a list of players and their game preferences, and if you planned ahead you might already know their last level etc or anything else you would like to tie to the player in the Userdata array.
The levels array is simple, no levels X 2 X 1.
Index level status (eg locked = 0, unlocked = 1, one star = 3) and highest score to date on that level. This simple array when added to the data which you harvested into Globals from the Playerdata array gives you all the information you need to do an angry birds 1-2-3 star menu layout etc with previous highest score for each level plus a cumulative high score to date all in just two simple arrays.
Why so simple?
You created a number of users who are identified by name and number.
When a new user is added to the PlayerData array, the logic creates a LevelsArray and saves it under that Username.
Tip Don't use persistent names such a "savegame" use variables such as "savegame"&Userid or simply Username (no duplicate check completed of course).
This probably doesn't seem particularly simple if you're unused to arrays think of it as two relational db tables joined by the key "Username". Collecting the data is as easy as using conventional HTML forms (which is basically what they are in C2 anyway)
Before I go let's just pop back to that first 6X8X1 array we created userdata.
Now what if we were to change the dimensions to something such as 6X8X2?
You've just provided each player with sufficient storage for an Inventory. <img src="smileys/smiley2.gif" border="0" align="middle" />