Inherits from CCSprite : CCNodeRGBA : CCNode : NSObject
Declared in CCPhysicsSprite.h
CCPhysicsSprite.mm

Overview

A CCSprite subclass that is bound to a physics body. It works with:

- Chipmunk: Preprocessor macro CC_ENABLE_CHIPMUNK_INTEGRATION should be defined
- Objective-Chipmunk: Preprocessor macro CC_ENABLE_CHIPMUNK_INTEGRATION should be defined
- Box2d: Preprocessor macro CC_ENABLE_BOX2D_INTEGRATION should be defined

Features and Limitations:

- Scale and Skew properties are ignored.
- Position and rotation are going to updated from the physics body
- If you update the rotation or position manually, the physics body will be updated
- You can't eble both Chipmunk support and Box2d support at the same time. Only one can be enabled at compile time

Tasks

Other Methods

Other Methods

  • – position

    Position (x,y) of the node in points. (0,0) is the left-bottom corner.

  • – setPosition:

    Position (x,y) of the node in points. (0,0) is the left-bottom corner.

  • – rotation

    The rotation (angle) of the node in degrees. 0 is the default rotation angle. Positive values rotate node CW.

  • – setRotation:

    The rotation (angle) of the node in degrees. 0 is the default rotation angle. Positive values rotate node CW.

  • – nodeToParentTransform

    Returns the matrix that transform the node’s (local) space coordinates into the parent’s space coordinates. The matrix is in Pixels.

  • – dirty

    whether or not the Sprite needs to be updated in the Atlas

Properties

CPBody

Body accessor when using regular Chipmunk

@property (nonatomic, assign) cpBody *CPBody

Declared In

CCPhysicsSprite.h

PTMRatio

b2Body

Body accessor when using box2d

@property (nonatomic, assign) *b2Body

Declared In

CCPhysicsSprite.h

chipmunkBody

Body accessor when using Objective-Chipmunk

@property (nonatomic, assign) ChipmunkBody *chipmunkBody

Declared In

CCPhysicsSprite.h

ignoreBodyRotation

Keep the sprite’s rotation separate from the body.

@property (nonatomic, assign) BOOL ignoreBodyRotation

Declared In

CCPhysicsSprite.h

Instance Methods

dirty

whether or not the Sprite needs to be updated in the Atlas

- (BOOL)dirty

Declared In

CCSprite.h

nodeToParentTransform

Returns the matrix that transform the node’s (local) space coordinates into the parent’s space coordinates. The matrix is in Pixels.

- (CGAffineTransform)nodeToParentTransform

Availability

Declared In

CCNode.h

position

Position (x,y) of the node in points. (0,0) is the left-bottom corner.

- (CGPoint)position

Declared In

CCNode.h

rotation

The rotation (angle) of the node in degrees. 0 is the default rotation angle. Positive values rotate node CW.

- (float)rotation

Declared In

CCNode.h

setPosition:

Position (x,y) of the node in points. (0,0) is the left-bottom corner.

- (void)setPosition:(CGPoint)position

Declared In

CCNode.h

setRotation:

The rotation (angle) of the node in degrees. 0 is the default rotation angle. Positive values rotate node CW.

- (void)setRotation:(float)rotation

Declared In

CCNode.h