LHScene Reference

Inherits from
Conforms to
LHScene.h

Overview

LHScene class is used to load a level file into SpriteKit engine. End users will have to subclass this class in order to add the game logic.

Instance Methods

backUINode

- (LHBackUINode *)backUINode
Discussion

Returns the Back UI node. All children of this node will NOT move with the camera.

Declared In
LHScene.h

createNodeObjectForSubclassWithName:superTypeName:

- (Class)createNodeObjectForSubclassWithName:(NSString *)subclassTypeName superTypeName:(NSString *)superTypeName
Parameters
subclassTypeName

The name of the your custom class.

superTypeName

The name of the original LevelHelper node class type. Your class must be a subclass of this type.

Discussion

Overwrite this method to return your own class type for specific nodes. Setup the class type in "Subclass" property of LevelHelper 2. Check LHSceneNodesSubclassingTest for how to use this method.

Your need to implement this function

  • (instancetype)nodeWithDictionary:(NSDictionary*)dict parent:(CCNode*)prnt;

and overwrite this method

  • (instancetype)initWithDictionary:(NSDictionary*)dict parent:(CCNode*)prnt;

Declared In
LHScene.h

didBeginContact:

- (void)didBeginContact:(SKPhysicsContact *)contact
Parameters
contact

Object containing the collision information. Available when using SpriteKit own physics engine. This methods just forwards the call to SpriteKit API. Consult Sprite Kit documentation for more info.

Discussion

Overwrite this methods to receive collision informations.

Declared In
LHScene.h

didCutRopeJoint:

- (void)didCutRopeJoint:(LHRopeJointNode *)joint
Discussion

Overwrite this method to receive notifications when a rope joint is cut.

Declared In
LHScene.h

didEndContact:

- (void)didEndContact:(SKPhysicsContact *)contact
Parameters
contact

Object containing the collision information. Available when using SpriteKit own physics engine. This methods just forwards the call to SpriteKit API. Consult Sprite Kit documentation for more info.

Discussion

Overwrite this methods to receive collision informations.

Declared In
LHScene.h

didFinishedPlayingAnimation:

- (void)didFinishedPlayingAnimation:(LHAnimation *)anim
Discussion

Overwrite this method to receive notifications when an animation has finished playing. This method is called once, after all repetitions have finished playing.

Declared In
LHScene.h

didFinishedRepetitionOnAnimation:

- (void)didFinishedRepetitionOnAnimation:(LHAnimation *)anim
Discussion

Overwrite this method to receive notifications when an animation has finished playing a repetition.

Declared In
LHScene.h

fileName

- (NSString *)fileName
Discussion

Returns the lhplist file name that was used to load this scene information. String does not contain extension.

Declared In
LHScene.h

gameWorldNode

- (LHGameWorldNode *)gameWorldNode
Discussion

Returns the game world node. All children of this node will move with the camera. For UI elements use the uiNode.

Declared In
LHScene.h

gameWorldRect

- (CGRect)gameWorldRect
Discussion

Returns the game world rectangle or CGRectZero if the game world rectangle is not set in the level file.

Declared In
LHScene.h

globalGravity

- (CGPoint)globalGravity
Discussion

Get the global gravity force.

Declared In
LHScene.h

relativePath

- (NSString *)relativePath
Discussion

Returns the relative plist path that was used to load this scene information.

Declared In
LHScene.h

setAnimationNotificationsDelegate:

- (void)setAnimationNotificationsDelegate:(id<LHAnimationNotificationsProtocol>)del
Parameters
del

The object that implements the LHAnimationNotificationsProtocol methods.

Discussion

Set a animation notifications delegate. When subclassing LHScene, if you overwrite the animation notifications methods make sure you call super or this will no longer work. If you delete the delegate object make sure you null-ify the animation notifications delegate.

Declared In
LHScene.h

setCollisionHandlingDelegate:

- (void)setCollisionHandlingDelegate:(id<LHCollisionHandlingProtocol>)del
Parameters
del

The object that implements the LHCollisionHandlingProtocol methods.

Discussion

Set a collision handling delegate. When subclassing LHScene, if you overwrite the collision handling methods make sure you call super or this will no longer work. If you delete the delegate object make sure you null-ify the collision handling delegate.

Declared In
LHScene.h

setGlobalGravity:

- (void)setGlobalGravity:(CGPoint)gravity
Parameters
gravity

A point representing the gravity force in x and y direction.

Discussion

Sets the global gravity force

Declared In
LHScene.h

textureAtlasWithImagePath:

- (SKTextureAtlas *)textureAtlasWithImagePath:(NSString *)atlasPath
Parameters
atlasPath

The path of the atlas (usually a sprite name)

Return Value

A texture atlas or nil if not found.

Discussion

Returns a SKTextureAtlas object that was previously loaded or a new one.

Declared In
LHScene.h

textureWithImagePath:

- (SKTexture *)textureWithImagePath:(NSString *)imagePath
Parameters
imagePath

The path of the image file.

Return Value

A texture object or nil if image could not be found.

Discussion

Returns a SKTexture object that was previously loaded or a new one.

Declared In
LHScene.h

uiNode

- (LHUINode *)uiNode
Discussion

Returns the Front UI node. All children of this node will NOT move with the camera.

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

Back to top

Copyright © VLADU BOGDAN DANIEL PFA.