LHSprite Reference


Overview

LHSprite class is used to load textured rectangles that are found in a level file. Users can retrieve a sprite object by calling the scene (LHScene) childNodeWithName: method.

Class Methods

createWithSpriteName:atlasFile:folder:parent:

+ (instancetype)createWithSpriteName:(NSString *)spriteFrameName atlasFile:(NSString *)imageFile folder:(NSString *)folder parent:(SKNode *)prnt
Parameters
spriteFrameName

A string which indicates the sprite frame name.

imageFile

A string which indicates the image file containing the sprite texture. This file will be used to look for the plist file.

folder

A string which indicates the folder that contains the image & plist file. The folder must be added as reference in Xcode - blue icon.

prnt

A parent node. Must be in the LHScene hierarchy.

Return Value

An autoreleased sprite object

Discussion

Creates a sprite with an sprite frame name using a sprite sheet name.

Eg:

PUBLISH_FOLDER/ (added as reference in Xcode - has Blue icon)
carParts-568.atlasc
carParts-667.atlasc
carParts-736.atlasc
carParts-ipad.atlasc
carParts.atlasc

LHSprite* sprite = [LHSprite createWithSpriteName:@"carBody" imageFile:@"carParts.atlasc" folder:@"PUBLISH_FOLDER/" parent:[self gameWorldNode]];
if(sprite){
   [sprite setPosition:location];
}

Declared In
LHSprite.h

Instance Methods

imageFilePath

- (NSString *)imageFilePath
Discussion

Returns the sprite image file path.

Declared In
LHSprite.h

setSpriteFrameWithName:

- (void)setSpriteFrameWithName:(NSString *)spriteFrame
Parameters
spriteFrame

The name of the sprite texture rectangle as defined in the Sprite Packing Editor.

Discussion

Change the sprite texture rectangle with the a new texture rectangle defined by the sprite frame with a specific name.

Declared In
LHSprite.h

spriteFrameName

- (NSString *)spriteFrameName
Discussion

Returns the sprite frame name.

Declared In
LHSprite.h
Last updated: 2015-2-12

Back to top

Copyright © VLADU BOGDAN DANIEL PFA.