-
Book Overview & Buying
-
Table Of Contents
Mastering iOS Game Development
By :
For now, import the Player images (in the sprites.atlas file) I have provided in the resources section of this book. Unless you have your own! Then by all means use yours.
Let's go back to our GameLevelScene.m file and import yet another file. This time, it will be #import "Player.h". Then, after the @interface section that we added earlier, we are going to add another property similar to the map property we just added: @property (nonatomic, strong) Player *player1. I used player1 because we will be adding in some multiplayer features later!
Then again, inside the initWithSize function we will add the following code:
self.player = [[Player alloc] initWithImageNamed:@"P1Idle"]; self.player.position = (CGPointMake(100, 50); self.player.zPosition = 15; [self.map addChild: self.player];
When we build and run our project, we should get similar results as seen in the following image. I think it's starting to look pretty cool!

Hold on cowboy...