O'Reilly logo

Mastering iOS Game Development by Miguel DeQuadros

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

Creating enemies

This game isn't simply an exploration game! We need to make this game intense and exciting!

Go ahead and import the Squiggy set of images that I've included, or again you can use your own.

Creating enemies

In our GameLevelScene.m file, we will add a new method to begin spawning random enemies. These ones will start off easy, but we will get into some baddies that will actually try to kill you!

Anyways, anywhere within the GameLevelScene.m file, add the following method:

- (void)addSquiggy { SKSpriteNode * squiggy = [SKSpriteNode spriteNodeWithImageNamed:@"Squiggy"]; int minY = squiggy.size.height / 2; int maxY = self.frame.size.height - squiggy.size.height ...

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