Fruity Crush Saga App Diary: Day 2

Fruits

Seeing your App on device for the first time (or even in the simulator) can be an amazing feeling. That was my goal for today. After having the images and enough model classes it was time to invoke the model from the GameViewController.
Architecturally, the Game Scene is the main object for most SpriteKit games. But since we are going to sprinkle in UIKit elements we’ll stick to a MVC where the GameViewController will play the role of the Controller.

This means the GameScene will be a View – albeit it, a very important one with the game layer. In the GameScene I added a level property and a SpriteKit Node Hierarchy in a gameLayer and fruitLayer properties (both SKNodes).

The GameScene will have a function for addingSpritesForFruits and a helper method for producing a point for a Fruit based on the column and row.

The GameViewController then has everything it needs to kick off a game as soon as the ViewDidLoad. For now its enough to wire the level random fruit maker and add that to the scene in order to tie the model to the view.

Running the current code brings up the 9×9 grid of fruits.

fruitycrush0

Tomorrow, I’ll load a level from a JSON file.

Leave a comment