O'Reilly logo

Sparrow iOS Game Framework Beginner's Guide by Johannes Stein

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

Time for action – arranging images in the pirate cove scene

To add images to the pirate cove scene, follow these steps:

  1. Open PirateCove.m.
  2. Import the Assets header file using the following line of code:
    #import "Assets.h"
  3. Remove the log message and add the background image, as shown in the following code:
    SPImage *background = [SPImage imageWithTexture:[Assets   texture:@"cove.png"]];
    background.x = (Sparrow.stage.width - background.width) / 2;
    background.y = (Sparrow.stage.height - background.height) / 2;
  4. Add our pirate ship, as shown in the following code:
    SPImage *pirateShip = [SPImage imageWithTexture:[Assets texture:@"ship_pirate.png"]]; pirateShip.x = Sparrow.stage.width - pirateShip.width - 120; pirateShip.y = Sparrow.stage.height - pirateShip.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