Our mission to create a game in a week is on! We are attempting to develop and release a new mobile game in just seven days. You can read all about what we’re doing, and why on this blog post, or view all the development diaries here.
After taking a day off yesterday to do some client-based work, today it was time to get stuck into the power-up mechanics and to code up the scoring system.
The scoring system was trickier to implement than I had imagined. My initial idea was to have an invisible object sitting above the tray so we could count how many pancakes were touching it, but this wouldn’t work as any pancakes falling in-line (and not stacked) could be miscounted. Detecting whether a pancake was touching a tray or touching another pancake wouldn’t be accurate either as when pancakes topple, they’re often touching and hitting each other.
So I settled on introducing a script that allows each pancake to report its last vertical position, and compare it to its current vertical position a fraction of a second later. Falling pancakes would report a large difference, likewise toppling pancakes would report a smaller difference. Pancakes stacked on the tray would report a very small difference (there may still be some, if a falling pancake or power-up had caused it to bounce) so I built in room-for-error, and we now have a very accurate scoring system.
In fact, I ended up modifying this script to also test whether a power-up had been caught too. And by removing the power up a split second later, it allows the power-ups (which are otherwise very useful) to cause some disruption on the stack – so the player will want to get in a good position to catch the power-up, so it doesn’t smash into the pile at an angle that might cause their stack to topple.
So the power-ups are in and working! If you catch a stopwatch, a button appears allowing you to add additional time to your game. If you catch a strawberry, a button appears allowing you to bank your stack (if you do so, your stack disappears allowing you to carry on with a clean tray).
I’ve also spent some time today working on the touch controls. The game is now playable with the keyboard, an Xbox controller, mouse, and touch. The mouse input is slightly buggy and needs some more work, but it’s pretty much there.
The next step is to get the animations working on our main character (he can react to events), and then it’s time to look at the cross-platform stuff in order to have this work on multiple mobile operating systems.