#import <CocosNode.h>
Inherited by AtlasNode, AtlasSprite, AtlasSpriteManager, Layer, MenuItem, ParticleSystem, Scene, and TextureNode.
The main features of a CocosNode are:
Some CocosNodes provide extra functionality for them or their children.
Subclassing a CocosNode usually means (one/all) of:
Features of CocosNode:
Limitations:
| - ((deprecated) __attribute__ |
Returns the absolute position of the CocosNode
| - ((deprecated) __attribute__ |
Removes all children from the container. It stops all running actions from the removed objects and unschedules all scheduled selectors
| - ((deprecated) __attribute__ |
Removes all children from the container.
| - (id) add: |
Adds a child to the container with z-order as 0
| - (id) add: | (CocosNode *) | node |
Adds a child to the container with a z-order
| - (id) add: | (CocosNode *) | node | ||
| z: | (int) | z | ||
Adds a child to the container with a z-order and a parallax ratio
| - (id) add: | (CocosNode *) | node | ||
| z: | (int) | z | ||
Adds a child to the container with z order and tag
| - (id) addChild: | (CocosNode *) | node |
Adds a child to the container with z-order as 0. It returns self, so you can chain several addChilds.
| - (id) addChild: | (CocosNode *) | node | ||
| z: | (int) | z | ||
Adds a child to the container with a z-order It returns self, so you can chain several addChilds.
| - (id) addChild: | (CocosNode *) | node | ||
| z: | (int) | z | ||
| parallaxRatio: | (CGPoint) | c | ||
Adds a child to the container with a z-order and a parallax ratio It returns self, so you can chain several addChilds.
| - (id) addChild: | (CocosNode *) | node | ||
| z: | (int) | z | ||
| tag: | (int) | tag | ||
Adds a child to the container with z order and tag It returns self, so you can chain several addChilds.
| - (CGPoint) convertToNodeSpace: | (CGPoint) | worldPoint |
converts a world coordinate to local coordinate
| - (CGPoint) convertToNodeSpaceAR: | (CGPoint) | worldPoint |
converts a world coordinate to local coordinate treating the returned/received node point as anchor relative
| - (CGPoint) convertTouchToNodeSpace: | (UITouch *) | touch |
XXX: needs documentation
| - (CGPoint) convertTouchToNodeSpaceAR: | (UITouch *) | touch |
XXX: needs documentation
| - (CGPoint) convertToWorldSpace: | (CGPoint) | nodePoint |
converts local coordinate to world space
| - (CGPoint) convertToWorldSpaceAR: | (CGPoint) | nodePoint |
converts local coordinate to world space treating the returned/received node point as anchor relative
| - (Action*) do: |
Executes an action, and returns the action that is executed
| - (void) draw |
override this method to draw your own node.
| - (Action*) getActionByTag: | (int) | tag |
Gets an action from the running action list given its tag
| - (CocosNode*) getByTag: |
Gets a child from the container given its tag
| - (CocosNode*) getChildByTag: | (int) | tag |
| - (id) init |
initializes the node
| + (id) node |
creates a node
| - (CGAffineTransform) nodeToWorldTransform |
actual affine transforms used XXX: needs documentation
| - (int) numberOfRunningActions |
Returns the numbers of actions that are running plus the ones that are schedule to run (actions in actionsToAdd and actions arrays). Composable actions are counted as 1 action. Example: If you are running 1 Sequence of 7 actions, it will return 1. If you are running 7 Sequences of 2 actions, it will return 7.
| - (void) onEnter |
callback that is called every time the node enters the 'stage'
| - (void) onExit |
callback that is called every time the node leaves the 'stage'.
| - (void) remove: |
Removes a child from the container
| - (void) removeAllChildrenWithCleanup: | (BOOL) | cleanup |
Removes all children from the container and do a cleanup all running actions depending on the cleanup parameter.
| - (void) removeAndStop: |
Removes a child from the container by reference and stops all running actions and scheduled functions
| - (void) removeAndStopByTag: |
Removes a child from the container by tag and stops all running actions and scheduled functions
| - (void) removeByTag: |
Removes a child from the container given its tag
| - (void) removeChild: | (CocosNode *) | node | ||
| cleanup: | (BOOL) | cleanup | ||
Removes a child from the container. It will also cleanup all running actions depending on the cleanup parameter.
| - (void) removeChildByTag: | (int) | tag | ||
| cleanup: | (BOOL) | cleanup | ||
Removes a child from the container by tag value. It will also cleanup all running actions depending on the cleanup parameter
| - (void) reorderChild: | (CocosNode *) | child | ||
| z: | (int) | zOrder | ||
Reorders a child according to a new z value. The child MUST be already added.
Executes an action, and returns the action that is executed. The target will be retained.
| - (void) schedule: | (SEL) | s |
check whether a selector is scheduled. schedules a selector. The scheduled selector will be ticked every frame
| - (void) schedule: | (SEL) | s | ||
| interval: | (ccTime) | seconds | ||
schedules a selector with an interval time in seconds. If time is 0 it will be ticked every frame.
| - (void) stopAction: | (Action *) | action |
Removes an action from the running action list
| - (void) stopActionByTag: | (int) | tag |
Removes an action from the running action list given its tag
| - (void) stopAllActions |
Removes all actions from the running action list
| - (void) transform |
performs OpenGL view-matrix transformation based on position, scale, rotation and other attributes.
| - (void) transformAncestors |
performs OpenGL view-matrix transformation of it's ancestors. Generally the ancestors are already transformed, but in certain cases (eg: attaching a FBO) it's necessary to transform the ancestors again.
| - (void) unschedule: | (SEL) | s |
unschedule a selector
| - (void) visit |
recursive method that visit its children and draw them
| - (CGAffineTransform) worldToNodeTransform |
XXX: needs documentation
- (Camera *) camera [read, assign] |
- (NSArray*) children [read, assign] |
An array with the children
- (GridBase *) grid [read, write, retain] |
A Grid object that is used when applying Effects
- (float) parallaxRatio [read, write, assign] |
The parallax ratio of the node. 1.0 is the default ratio
- (float) parallaxRatioX [read, write, assign] |
The Y parallax ratio of the node. 1.0 is the default ratio
- (float) parallaxRatioY [read, write, assign] |
The X parallax ratio of the node. 1.0 is the default ratio
- (CocosNode *) parent [read, write, assign] |
A weak reference to the parent
- (CGPoint) position [read, write, assign] |
Position (x,y) of the node in OpenGL coordinates. (0,0) is the left-bottom corner
- (BOOL) relativeTransformAnchor [read, write, assign] |
If YES the transformtions will be relative to (-transform.x, -transform.y). Sprites, Labels and any other sizeble object use it. Scenes, Layers and other "whole screen" object don't use it.
- (float) rotation [read, write, assign] |
The rotation (angle) of the node in degrees. 0 is the default rotation angle
- (float) scale [read, write, assign] |
The scale factor of the node. 1.0 is the default scale factor
- (int) tag [read, write, assign] |
A tag used to identify the node easily
- (CGPoint) transformAnchor [read, write, assign] |
- (BOOL) visible [read, write, assign] |
Whether of not the node is visible. Default is YES
- (int) zOrder [read, assign] |
The z order of the node relative to it's "brothers": children of the same parent
1.5.8