Book Image

Sparrow iOS Game Framework Beginner's Guide

By : Johannes Stein
Book Image

Sparrow iOS Game Framework Beginner's Guide

By: Johannes Stein

Overview of this book

Table of Contents (20 chapters)
Sparrow iOS Game Framework Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Afterword
Index

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 - 10;
  5. Add a house, as shown in the following code:

    SPImage *house = [SPImage imageWithTexture:[Assets   texture:@"house.png"]];
    house.x = 100;
    house.y = 100;
  6. Add a tavern, as shown in the following code:

    SPImage *tavern = [SPImage imageWithTexture...