Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Cocos2d Game Development Essentials

You're reading from   Cocos2d Game Development Essentials For new users - a quickstart guide to bringing your mobile game ideas to life with Cocos2D

Arrow left icon
Product type Paperback
Published in Jan 2015
Publisher
ISBN-13 9781784390327
Length 136 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Ben Trengrove Ben Trengrove
Author Profile Icon Ben Trengrove
Ben Trengrove
Arrow right icon
View More author details
Toc

Adding joints


A joint does exactly what it sounds like it would do. It joins objects together. There are three types of joints:

  • Physics Pivot Joint: This connects two objects with a single point

  • Physics Distance Joint: This connects two objects together at a set distance

  • Physics Spring Joint: This connects two objects together at a set distance, but instead of the joint being rigidly set, it allows the distance to change in the manner of a spring

  1. The first step is to make the base of your catapult static. You don't want it to move throughout the scene.

  2. The joint you will be using is the first option: the physics pivot joint as you want your catapult arm to pivot around a point.

    All of the physics joints are available in the SpriteBuilder objects pane.

  3. Drag Physics Pivot Joint onto the scene and position it in the top-right corner of the catapult base.

  4. Next, move the catapult arm so that its anchor point sits exactly at the center of the pivot joint. You can also rotate the arm so that it is facing...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image