Second Wind: Reprieve

I can’t believe it but just as I was about to submit the assessment we had received an email extending the assessment due date for another week.  So I’m going to try and figure out this scoreboard and hopefully get the final weapons and spider AI implemented.

So with the scoreboard, the brief requires us to store the top ten player scores that carry across all levels.  I attempted a basic scoreboard in the last game project we had and failed utterly.  I know player preferences are used, but I’m not going to lie I’m weak with arrays and loops, something player prefs use both of.

My first hurdle was carrying the score across the multiple levels I had.  Initially this wasn’t working as whenever the player died so too would the score.  I had to somehow keep all the data the brief required alive and store it for the scoreboard.  While the answer is essentially in what I just said, it took me two days to figure out to create an empty game object and use the Don’tDestroy function to keep the data from destroying.

Now that I had the data working I now had to save it and retrieve it whenever the game was either loaded or exited.  SetPlayerPrefs and GetPlayerPrefs allowed me to do this which also allowed me to save the name of the player.  Mind you even though this took probably 8 seconds to read, it took me hours to figure out.

With all the data saving and loading properly I now had to sort it from highest to lowest.  Unfortunately, I couldn’t figure it out.  From what I could find, I believe that I needed to use something called a bubble sort, but for the life of me I couldn’t figure it out.  Some of this coding stuff is just beyond me at the moment.

Unfortunately I spent so much time on trying to finish the scoreboard that I failed to implement final weapons and spider AI into my game.  I’ve said it before and I’ll say it again, the simplest of features in games that we take for granted require so much knowledge and skill to implement.  With this project finished, I now have to think about the JRPG project next.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s