O'Reilly logo

Build iOS Games with Sprite Kit by Josh Smith, Jonathan Penn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Drawing Scenes and Sprite Nodes

The template is a fine starting point, but if you’re going to send the spaceship on a daring rescue mission, you need to figure out how to draw it yourself and understand what’s going on. In this section, we’re going to write code to experiment with scene setup and then talk about what goes on behind the curtain.

Start by deleting the contents in the RCWMyScene.m file that came with the template. Replace it with this implementation of the RCWMyScene class that displays the spaceship image in the middle of the screen:

01-SpriteIntro/step01/SpaceRun/RCWMyScene.m
 
#import ​"RCWMyScene.h"
 
 
@implementation​ RCWMyScene
 
 
- (id)initWithSize:(CGSize)size
 
{
 
if​ (self = [super initWithSize:size]) {
 
self.backgroundColor ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required