Hello all,
Okay so I’m making a high score table for a game me and a friend have been developing it only needs to contain a three letter name and a score.
So far I have whipped up some test action script which looks like this:
var scoreEntry :Array = [{playerName:"Adam",score:1254},{playerName:"Ben",score:4352},{playerName:"Chris",score:7896},{playerName:"Dan",score:100000},{playerName:"Ed",score:8900}];
function onEnterFrame(){
scoreEntry.sortOn("score", Array.NUMERIC | Array.DESCENDING);
highScore.highScoreOne = scoreEntry[0].playerName+" "+scoreEntry[0].score;
highScore.highScoreTwo = scoreEntry[1].playerName+" "+scoreEntry[1].score;
highScore.highScoreThree = scoreEntry[2].playerName+" "+scoreEntry[2].score;
highScore.highScoreFour = scoreEntry[3].playerName+" "+scoreEntry[3].score;
highScore.highScoreFive = scoreEntry[4].playerName+" "+scoreEntry[4].score;
}
Now this works fine for some test code. (Gotta love the sortOn function!)
Here comes the twist, when the player comes to enter their name if they make it to the end of the game the only keys I have avaliable to them to enter their name is a,b,up,down,left,right.
Whats the reason for this I here you cry…well it looks a little somthing like this:
As I’m still learning actionscript and for some reason actually loving the challenge of learning somthing new etc what I’m really looking for is some brain storming or a nudge in a good direct rather than an actual soloution.
At the moment I’m leaning towards using up and down to cycle through the
ASCII key code and using the A or B button to lock the selected code and then store it into an array then moving on to another function to cycle through for the next letter and so on.
Once it reaches the max letters (3) i use the three positions in the array [0,1,2] to store the complete name in another array. Then using that array with the score var (_global.score); to store in the final array which should look like the code above.
All of this is an just idea and have no idea if it would work, I’m yet to test any of it.
Was just wondering if anyone had any thoughts, ideas of their own etc. Any input would be greatly appreciated.
Thanks in advance.