Initializing the game
Once we've set up everything, we can initialize the game by creating a new Wizard
instance with its attributes and deck of cards.
First thing, declare two private instance variables by adding the following lines to the @implementation
block in GameScene.m
:
// Declare global variable for screen size CGSize _screenSize; // Declare current player instance Wizard *_currentPlayer;
We want to store the screen size for later calculations and keep the information of the player executing the game; this is the aim of the previous variables.
We need to add a background image to the screen, but first we need to include it in the project, so follow these steps:
Right-click on the Resources group and select Add Files to "ElementalWizards"….
Select the
background.png
image that you will find in theResources
folder.Be sure that Copy items into destination group's folder (if needed) is selected and click on Add.
Once the image is available in the project, we can add the following...