Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Learning Cocos2d-JS Game Development

You're reading from   Learning Cocos2d-JS Game Development Learn to create robust and engaging cross-platform HTML5 games using Cocos2d-JS

Arrow left icon
Product type Paperback
Published in Jan 2015
Publisher
ISBN-13 9781784390075
Length 188 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Emanuele Feronato Emanuele Feronato
Author Profile Icon Emanuele Feronato
Emanuele Feronato
Arrow right icon
View More author details
Toc

Table of Contents (18) Chapters Close

Learning Cocos2d-JS Game Development
Credits
Foreword
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Hello World – A Cross-platform Game FREE CHAPTER 2. Adding Interactivity – The Making of a Concentration Game 3. Moving Sprites Around the Screen – An Endless Runner 4. Learn about Swipes through the making of Sokoban 5. Become a Musical Maestro 6. Controlling the Game with Virtual Pads 7. Adding Physics to Your Games Using the Box2D Engine 8. Adding Physics to Your Games Using the Chipmunk2D Engine 9. Creating Your Own Blockbuster Game – A Complete Match 3 Game Index

Chapter 8. Adding Physics to Your Games Using the Chipmunk2D Engine

In the previous chapter, you saw how to add physics to your games using Box2D. However, Box2D isn't the only physics engine supported by Cocos2d-JS; you can also feature physics in your games using the Chipmunk2D engine.

So the main question is: should you use Box2D or Chipmunk2D to add physics to your games? There isn't a right answer. Just use the one you feel the most comfortable with.

That's why, in this chapter, I will show you how to create the same Totem Destroyer game using Chipmunk2D, highlighting the similarities and differences between the two physics engines.

As you saw in the previous chapter, it's time to learn:

  • Configuring Cocos2d-JS to add Chipmunk2D engine to your games

  • Creating a physics space with gravity

  • Combining bodies and shapes to create a physics object

  • Creating a material

  • Creating static objects

  • Creating dynamic objects

  • Attaching sprites to physics objects

  • Selecting physics objects with the mouse or finger...

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 £13.99/month. Cancel anytime
Visually different images