Game Development Reference
In-Depth Information
Figure 10-7 . Uncheck the “Trim sprites” check box to prevent the images from being rotated
Unchecking Trim sprites prevents the player image from possibly being rotated. The cus-
tom drawing code does not account for the sprite frame possibly being rotated within the
Sprite Sheet.
Drawing the Texture with CCRenderer
What's left is to actually draw the texture based on each body's current position. In Co-
cos2D, all custom drawing has to be done within the draw:transform: method, using
the supplied CCRenderer object. Add the code in Listing 10-13 below the up-
dateTextureCoordinates method in SoftBodyDrawNode.m .
Listing 10-13 . Drawing the soft-body texture
-(void) draw:(CCRenderer *)renderer transform:(const
GLKMatrix4 *)transform
{
Search WWH ::




Custom Search