Programming this second Hugomatica App, Divino Minecraft Edition, the team leveraged the existing skills and algorithms for randomization, and added new skills.
To create the game part of the app, we implemented randomization using Apple’s “arc4random_uniform()” function to select random Minecraft answers to present. So the algorithm provides fun with the unexpected.
Next we needed to make sure that there were no repeats within a game. So, we used the Swift “removeAtIndex” function. Afterwards, we reset the array to put all of the elements back for the next game play.
And we also developed some new skills and created new features for this game. Below are the geeky details.
Dictionary Key-Value Pairs
In other guessing game apps, answers are simple and other players can easily provide good clues. For example, for the answer “banana”, the clues are obvious.
However, for Divino Minecraft Edition, kids may know that a “Nether Star” is “Dropped From the Wither and Used to Make a Beacon”, but adults may need a clue prompt.
So, we used a Swift Dictionary which is an unordered collection of keys and values, also called a key-value pair. The Dictionary was set as type [String:String] and the answer and clue are populated on the screen together.
Accelerometer: Shake the Device for a Correct Answer
For the game, we needed an easy way for the Player to indicated that the got an answer correct. Also we wanted to make it fun. So we used the built in Accelerometer and the Shake Gesture Recognizer.
When the other players let you know that you guessed the right answer, just shake the iPhone and it records a point.
Sound Effects With AVFoundation
When the player shakes the iPhone for a “Hit” or touches the screen for a “Miss”, we wanted to provide additional reinforcement. So, in addition to a visual indicator we provide a sound as well. To incorporate sounds, we used the Swift AVFoundation kit with the AVAudioplayer.
Fireworks with SKEmitterNode
With this being a game for kids, we wanted to add fireworks for visual interest at the end of each game. Therefore, while the final game score and answer tallies are being populated, we added in a short burst of fireworks using Swift’s SpriteKit framework. With the SKEmitterNode, we specified a starter particle image, life span and spawn rate.
What’s Next for Divino Minecraft Edition
Ellen DeGeneres needs to acquire this App, since would be a good complement to the Heads Up portfolio.