As I stated in my previous post, I'm looking at recreating the Flash game 'Tonti' just to get an idea what it takes to develop such a game. Here is what I've got so far:
Tonti Game
Click on the start button (instead of typing "0").
If you want to play the original game, go here.
This is not supposed to be an exact copy. I'm just trying to emulate the same functionality. So far I was able to create the interface, make the individual movies of the character popping up, getting the keystrokes for 'whacking' the Tonti, and keeping a basic score. I was also able to make a pause button work, which was not as easy as it seems.
First off, to save time I just took a few screenshots of the original game. I roughly made duplicates of a few parts to use for each row of characters.
After doing some web research on determining how to read a keydown event in Flash, I was able to get some interactivity into it. Instead of the little mallet, I used an explosion, which I thought was a little more exciting when whacking the Tonti. The explosion consists of about 13 individual images of an explosion. I had to code it in such a way that you could only blow it up if it were showing. So when the Tonti character gets so far up, I set a variable that it is available to be hit. When it goes back down, it's not able to be hit.
I used a timer mechanism to randomly trigger each of the 9 Tontis to come up. It's not going nearly as fast as the original game, but I can change that by adjusting the timer. I did run into a problem with this. What was happening at first was that if a Tonti was coming up and its number got randomly called again, it would disappear and start over again. So I had to add a variable to tell it to skip a number if its animation was already active. Not sure how the original game pulls this off, but that's how I did it.
The pause button on the lower left works, although you have to click on it instead of typing a "0" key. It was easy enough to stop each of the 9 animations, but when you click it again to resume, that's when it got a bit tricky. I checked to see if an animation is active before telling it to play or I'd be telling them all to play.
Scoring was pretty simple. At the end of the animation sequence where the Tonti blows up, I just increment the score variable by 200 and it's displayed on the lower right.
I decided that 20 Tonti was good enough to be considered a level, so I put a counter in the timer mechanism that counts every time it fires. After 20, it kills the timer.
Not sure how much further I'll take this, but it's helped me think about how to set up a game. I'm a big fan of backwards engineering things to see how they work (or might work).