Game Development Reference
In-Depth Information
// 2
circlularObject.physicsBody = [SKPhysicsBody
bodyWithCircleOfRadius:circlularObject.frame.size.width/
2];
// 3
circlularObject.physicsBody.friction = 0.0f;
// 4
circlularObject.physicsBody.restitution = 1.0f;
// 5
circlularObject.physicsBody.linearDamping = 0.0f;
// 6
circlularObject.physicsBody.allowsRotation = NO;
Here we have created the sprite and then we have added it to the scene. Then in
the later steps we associate the circular physics body with the sprite object. Fin-
ally, we alter the properties of that physics body.
7. Now compile and run the application; you should be able to see the circular ball
on the screen as shown in screenshot below:
8. The circular ball is added to the screen, but it does nothing. So it's time to add
some action in the code. Add the following line of code at the end of the
initWithSize method:
Search WWH ::




Custom Search