Chapter    10

Soft-Body Physics

In this chapter, you will change the player character from a rigid object to a soft-body physics object. A soft body is an object whose predetermined shape can bend and flex under the forces applied to it. If the body is also trying to relax back into its predetermined shape, it is often referred to as “jelly” physics—especially if the shape is easily deforming and altogether wobbly. That’s the kind of soft body you’ll create in this chapter.

Since a deformable body changes its shape, the texture (sprite) used to display the body needs to be deformed also. A regular CCSprite won’t do that, as skewing and scaling the texture alone won’t suffice. So in the second half of this chapter you’ll dive into Cocos2D’s rendering ...

Get Learn SpriteBuilder for iOS Game Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.