Brain Tuner

 

Brain Tuner

 

In my first year at University I studied OOP for the first time. After developing in C# for the year I decided to take what I’d learnt and see if I could recreate a much loved iPhone game as my first ever ActionScript project.

 

I decided to recreate the Brain Tuner iPhone game from Gengar Studios because I felt that it would be a challenging first ActionScript project as well as an fun finished product.

 

In my Document class I first wrote the random equation generator that added 20 questions to an array. If the question was randomly selected to become an incorrect question, then a random number between 1-10 was generated to either positively or negatively offset the answer.

 

All the questions are written to the stage at the start of the game. I then used TweenLite to move the questions and blue overlay to highlight the next question. The line height of the text field renders differently on Macs and Windows so I also had to ensure that the Tween adjusted for each OS.

 

The timer for the game is worked out using the Date class. Two date stamps are taken at the start and the finish of the game. The number of milliseconds between the two is then calculated to work out the players time. I used this method rather than setting up a millisecond Timer because I found it to be a lot more accurate.

 

Brain Tuner

 

At the end of the game the player is presented with their time, the number of penalty seconds for incorrect answers and their final score. They can then submit their final score to an online database to see whether they can make it in to the top ten.

 

The players name and score are sent to the database using PHP and MySQL technologies. The top ten quickest times are currently displayed in the sidebar of this site as well as a row count to determin the total number of scores submitted so far.

 

The game turned out to be quite a success for my first ActionScript project and hopefully there will be some tough competition between everyone for those top ten highscore places. Feel free to leave your comments, thoughts and ideas for improvement. I would also appriciate your feedback on the following questions.

  • Is there a solution to fix the different line height rendering between Windows and Macs?
  • Is calculating the number of milliseconds between two Date stamps the best method for the game timer?
  • Is communicating with the database via PHP best practice, or can ActionScript do the job just as well?

5 Comments

  1. Tristan

    there u go mate. it looks real good. had no errors :)

  2. VK

    Slick job man .. would be great to work on visual stats for the high scores!

  3. Stu

    Nice work! Very smooth to play. Regards your questions, PHP is definitely the best solution for what you need.

  4. James Beith

    Glad you like it. Thanks for your thoughts on the use of PHP as well.

  5. Gary Whitlock

    How in the hell are people getting 9secs on that game….