Time for action – arranging images in the pirate cove scene
To add images to the pirate cove scene, follow these steps:
Open
PirateCove.m
.Import the
Assets
header file using the following line of code:#import "Assets.h"
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;
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;
Add a house, as shown in the following code:
SPImage *house = [SPImage imageWithTexture:[Assets texture:@"house.png"]]; house.x = 100; house.y = 100;
Add a tavern, as shown in the following code:
SPImage *tavern = [SPImage imageWithTexture...