Tuesday, 11 April 2017

Sum Fun - Day 2

Day 2

Having a working game on day 1, I thought I'd do a bit more than add sound on day 2. I was confident I'd have time to fit more in.

Adding Juice

Kenney.nl has an system website pixeland.io which has a great list of videos for budding indie game developers to consume to help improve their games. This video is just a must see and is all about Tweening:

This lead me to a great free Unity3D asset for tweening called LeanTween. It sells itself as being the fastest tweening library but the real joy as a developer is the lightweight, fluent syntax:

LeanTween.moveX(go, 1f, 2f).setEase(LeanTweenType.easeInQuad).setDelay(1f).setOnComplete( someMethod );
Understanding all the tweening easing functions wasn't obvious until I stumbled across easings.net. It has interactive graphics for all the standard easing functions and they match up with the LeanTween ones pretty well:

I set about juicing up my graphics, adding small animations to the following:
  • Slide start menu off-screen (and back again at the end)
  • Scale in and out the score and timer when they change value
  • Bounce the tiles in the grid into place at the start
  • Elastic the selected tiles into the left and right tile slots of the sum
  • Shake the whole sum when you make an incorrect guess
  • Pop out the adjacent tiles for the second choice in the sum
These are small but simple changes that don't affect the game mechanic, or code flow, in any way at all, but the change to the feel of the game it just outstanding. I'm convinced it's as essential a step as the sound or the graphics themselves.


I didn't venture beyond Kenney.nl for my sound assets and ended up using the female voice from the voice-over pack, one of the switch sounds from the ui-audio pack and the tone1 (pong) sound from the digital-audio pack.

For the music I went back to opengameart.org and found the ideal BossaNova tune. All my audio clips were now in place and wired up to the various states of the game. Easy-peasy.

Background and Splash Screen

My previous game had no splash screen and I felt that was missing when the app started, especially on a phone where the screen just went black for a few seconds. I headed to Google in search of free (to reuse) images and found freeimages.co.uk.

I wanted the background and splashscreen to look like a chalk board that had sums on them. I was not dissappointed. A bit of WordArt in Microsoft Word ,with Google's Oswald font which is included in TextMeshPro, and I had a splash screen:

Game Over

I wanted to add a small amount of persistence to this game to see how it works. The High Score was the obvious choice and it turns out it's really easy to do. Unity's PlayerPrefs class has it all and it's very simple and intuitive to use.

public class ExampleClass : MonoBehaviour {
    void Example() {
        PlayerPrefs.SetInt("High Score", 10);
This allowed me to easily add in a sliding panel, with graphics from Kenney.nl, that shows the score and the high score. To top it off if the score was a new high score I bounced some text that says New High Score at the bottom of the pane. LeanTween'ing all the way. 

End of Day 2

This time there is no day 3. I got it all done in 2 days from conception to production. The end product feels a lot more polished as well and I can see how it could be enhanced to add extra tile types and different sum types (=, -, /, *, etc.). For now though I'm done...

Get it on Google Play

No comments:

Post a Comment