SKNode(KoboldKit) Category Reference
Conforms to | KKPhysicsContactEventDelegate KKSceneEventDelegate |
Declared in | SKNode+KoboldKit.h |
Tasks
Changing the Node's Position
Observing Node's Child Status
Working with Controllers
-
controller
property -
– createController
-
– removeController
-
model
property -
info
property -
– pauseControllersInNodeTree:
-
– resumeControllersInNodeTree:
Accessing the KKScene
-
kkScene
property
Working with Behaviors
-
– addBehavior:
-
– addBehavior:withKey:
-
– addBehaviors:
-
– behaviorForKey:
-
– behaviorKindOfClass:
-
– behaviorMemberOfClass:
-
– hasBehaviors
-
– removeBehavior:
-
– removeBehaviorForKey:
-
– removeBehaviorWithClass:
-
– removeAllBehaviors
Subscribe to input events
Subscribe to scene events
Subscribe to physics contact events
Subscribe to notifications
-
– observeNotification:selector:
-
– observeNotification:selector:object:
-
– disregardNotification:
-
– disregardNotification:object:
-
– disregardAllNotifications
-
– physicsBodyWithEdgeLoopFromPath:
-
– physicsBodyWithEdgeChainFromPath:
-
– physicsBodyWithRectangleOfSize:
-
– physicsBodyWithCircleOfRadius:
-
– physicsBodyWithTilemapObject:
-
– playSoundFileNamed:
-
– isEqualToNode:
-
– isEqualToNodeTree:
Properties
controller
the node’s controller object.
@property (atomic) KKNodeController *controller
Return Value
the node’s controller object.
Declared In
SKNode+KoboldKit.h
info
The node’s model
@property (atomic, readonly) KKModel *info
Return Value
The node’s model
Declared In
SKNode+KoboldKit.h
kkScene
Returns the node’s scene object, cast to KKScene. Use this instead of scene to use KKScene’s methods and properties.
@property (atomic, readonly) KKScene *kkScene
Declared In
SKNode+KoboldKit.h
Instance Methods
addBehavior:
Adds a behavior to the node. The behavior will be copied.
- (void)addBehavior:(KKBehavior *)behavior
Parameters
- behavior
The behavior to add.
Declared In
SKNode+KoboldKit.h
addBehavior:withKey:
Adds a behavior to the node with a key. Replaces any existing behavior with the same key. The behavior will be copied.
- (void)addBehavior:(KKBehavior *)behavior withKey:(NSString *)key
Parameters
- behavior
The behavior to add.
- key
A unique key used to identify the behavior.
Declared In
SKNode+KoboldKit.h
addBehaviors:
Adds multiple behaviors from an array. The behaviors will be copied.
- (void)addBehaviors:(NSArray *)behaviors
Parameters
- behaviors
An array containing behaviors to add.
Declared In
SKNode+KoboldKit.h
behaviorForKey:
The behavior for the key. Returns nil if no behavior with that key was found.
- (id)behaviorForKey:(NSString *)key
Parameters
- key
A unique key identifying the behavior.
Return Value
The behavior for the key. Returns nil if no behavior with that key was found.
Declared In
SKNode+KoboldKit.h
behaviorKindOfClass:
The first behavior of the given kind of class. Returns nil if no behavior with that class was found.
- (id)behaviorKindOfClass:(Class)behaviorClass
Parameters
- behaviorClass
The Class of the behavior.
Return Value
The first behavior of the given kind of class. Returns nil if no behavior with that class was found.
Declared In
SKNode+KoboldKit.h
behaviorMemberOfClass:
The first behavior that is a member of the given class. Returns nil if no behavior with that class was found.
- (id)behaviorMemberOfClass:(Class)behaviorClass
Parameters
- behaviorClass
The Class of the behavior.
Return Value
The first behavior that is a member of the given class. Returns nil if no behavior with that class was found.
Declared In
SKNode+KoboldKit.h
centerOnNode:
Changes the receiver’s position so that it is centered on the given node.
- (void)centerOnNode:(SKNode *)node
Parameters
- node
The node to center on.
Declared In
SKNode+KoboldKit.h
createController
Creates node controller if one does not exist yet. Returns the new or existing instance.
- (KKNodeController *)createController
Declared In
SKNode+KoboldKit.h
didMoveToParent
Called after addChild / insertChild. The self.scene and self.parent properties are valid in this method.
- (void)didMoveToParent
Declared In
SKNode+KoboldKit.h
disregardAllNotifications
Receiver disregards any and all notification sent by the notification center.
- (void)disregardAllNotifications
Declared In
SKNode+KoboldKit.h
disregardInputEvents
Receiver stops receiving all input events.
- (void)disregardInputEvents
Declared In
SKNode+KoboldKit.h
disregardNotification:
Receiver disregards all notifications with the given name.
- (void)disregardNotification:(NSString *)notificationName
Parameters
- notificationName
A string uniquely identifying the notification.
Declared In
SKNode+KoboldKit.h
disregardNotification:object:
Receiver disregards notifications with the given name coming from a specific object.
- (void)disregardNotification:(NSString *)notificationName object:(id)notificationSender
Parameters
- notificationName
A string uniquely identifying the notification.
- notificationSender
The notification sender object whose notifications are observed.
Declared In
SKNode+KoboldKit.h
disregardPhysicsContactEvents
Receiver stops receiving the physics contact events.
- (void)disregardPhysicsContactEvents
Declared In
SKNode+KoboldKit.h
disregardSceneEvents
Receiver stops receiving all scene events.
- (void)disregardSceneEvents
Declared In
SKNode+KoboldKit.h
hasBehaviors
YES if the node has one or more behaviors.
- (BOOL)hasBehaviors
Return Value
YES if the node has one or more behaviors.
Declared In
SKNode+KoboldKit.h
observeInputEvents
Receiver starts receiving input events. The receiver will receive any event method for touches, accelerometer, keyboard, mouse by simply implementing the corresponding input event method (ie touchesBegan:withEvent:).
- (void)observeInputEvents
Declared In
SKNode+KoboldKit.h
observeNotification:selector:
Receiver observes notifications posted by notification center.
- (void)observeNotification:(NSString *)notificationName selector:(SEL)notificationSelector
Parameters
- notificationName
A string uniquely identifying the notification.
- notificationSelector
The selector that is performed when a matching notification was received. Selector takes a single NSNotification object as parameter.
Declared In
SKNode+KoboldKit.h
observeNotification:selector:object:
Receiver observes notifications posted by notification center but only those notifications posted by a specific object.
- (void)observeNotification:(NSString *)notificationName selector:(SEL)notificationSelector object:(id)notificationSender
Parameters
- notificationName
A string uniquely identifying the notification.
- notificationSelector
The selector that is performed when a matching notification was received. Selector takes a single NSNotification object as parameter.
- notificationSender
The notification sender object whose notifications are observed.
Declared In
SKNode+KoboldKit.h
observePhysicsContactEvents
Receiver starts receiving both physics contact events. Receiver only needs to implement the corresponding event methods.
- (void)observePhysicsContactEvents
Declared In
SKNode+KoboldKit.h
observeSceneEvents
Receiver starts receiving all scene events. These events include update, didSimulatePhysics, didEvaluateActions as well as scene resizing and scene move to/from view. Receiver only needs to implement the corresponding event methods.
- (void)observeSceneEvents
Declared In
SKNode+KoboldKit.h
pauseControllersInNodeTree:
Pauses all controllers of the nodes beginning with rootNode.
- (void)pauseControllersInNodeTree:(SKNode *)rootNode
Parameters
- rootNode
The node whose node tree will be paused.
Declared In
SKNode+KoboldKit.h
physicsBodyWithCircleOfRadius:
Creates a physics Body with circle shape. Also assigns the physics body to the node’s self.physicsBody property.
- (SKPhysicsBody *)physicsBodyWithCircleOfRadius:(CGFloat)radius
Parameters
- radius
The circle radius.
Return Value
The newly created SKPhysicsBody.
Declared In
SKNode+KoboldKit.h
physicsBodyWithEdgeChainFromPath:
Creates a physics Body with edge chain shape. Also assigns the physics body to the node’s self.physicsBody property.
- (SKPhysicsBody *)physicsBodyWithEdgeChainFromPath:(CGPathRef)path
Parameters
- path
The CGPath with chain points.
Return Value
The newly created SKPhysicsBody.
Declared In
SKNode+KoboldKit.h
physicsBodyWithEdgeLoopFromPath:
Creates a physics Body with edge loop shape. Also assigns the physics body to the node’s self.physicsBody property.
- (SKPhysicsBody *)physicsBodyWithEdgeLoopFromPath:(CGPathRef)path
Parameters
- path
The CGPath with edge points.
Return Value
The newly created SKPhysicsBody.
Declared In
SKNode+KoboldKit.h
physicsBodyWithRectangleOfSize:
Creates a physics Body with rectangle shape. Also assigns the physics body to the node’s self.physicsBody property.
- (SKPhysicsBody *)physicsBodyWithRectangleOfSize:(CGSize)size
Parameters
- size
The size of the rectangle.
Return Value
The newly created SKPhysicsBody.
Declared In
SKNode+KoboldKit.h
physicsBodyWithTilemapObject:
nd
- (SKPhysicsBody *)physicsBodyWithTilemapObject:(KKTilemapObject *)tilemapObject
Declared In
SKNode+KoboldKit.h
playSoundFileNamed:
nd
- (void)playSoundFileNamed:(NSString *)soundFile
Declared In
SKNode+KoboldKit.h
removeAllBehaviors
Removes all behaviors from the node.
- (void)removeAllBehaviors
Declared In
SKNode+KoboldKit.h
removeBehavior:
Removes the behavior.
- (void)removeBehavior:(KKBehavior *)behavior
Parameters
- behavior
The behavior to remove.
Declared In
SKNode+KoboldKit.h
removeBehaviorForKey:
Removes the behavior with the given key.
- (void)removeBehaviorForKey:(NSString *)key
Parameters
- key
The unique key identifying the behavior.
Declared In
SKNode+KoboldKit.h
removeBehaviorWithClass:
Removes the first behavior with the given class.
- (void)removeBehaviorWithClass:(Class)behaviorClass
Parameters
- behaviorClass
The Class of the behavior.
Declared In
SKNode+KoboldKit.h
removeController
Removes the controller from the node.
- (void)removeController
Declared In
SKNode+KoboldKit.h