High Score TableFlash Code - Insering a HighscorePaste the following function inside your Flash document: ( categories: )
Flash Code - Fetching HighscoresNow we have our two php scripts to manipulate the database, all we need to do is call these pages from our Flash code (or whatever language your game maybe coded in). Include the following code near the start of your Flash document: ( categories: )
Getting and Posting ScoresNow we need to provide the interfaces for our program to the database. This will be by means of two php scripts; one for posting a score, the other for fetching the high score table. These will be called, with the correct parameters, from our Flash program (or indeed any program that has internet access).
Fetching the Highscore Table The first script we need is getscores.php. The only parameter is gameid, which we will set to '1' for now. This is so that we can use the database to store high scores for different games. ( categories: )
Creating the DatabaseCreate a database highscores and a table scores as the following structure: ( categories: )
Creating a High Score TableIntroduction Everyone wants prove they are "the best of the best", and what better way to prove it than getting your name into the halls of fame. A high score table will allow others to pit their wits against each other, while also giving an incentive to play again. For this tutorial, you will need:
Although the code examples will be using php / mysql / flash, the techniques will work using (for example) SQL Server / ASP / C++.
( categories: )
|
User login |