Adding Physics To Your Games Using The Chipmunk2D Engine

  • Book Overview & Buying Learning Cocos2d-JS Game Development
  • Table Of Contents Toc
  • Feedback & Rating feedback
Learning Cocos2d-JS Game Development

Learning Cocos2d-JS Game Development

By : Emanuele Feronato
3.9 (11) Buy this Book close close Learning Cocos2d-JS Game Development

Learning Cocos2d-JS Game Development

3.9 (11)
By: Emanuele Feronato
Buy this Book

Overview of this book

If you are a Java developer who wants to learn about Java EE, this is the book for you. It's also ideal for developers who already have experience with the Java EE platform but would like to learn more about the new Java EE 7 features by analyzing fully functional sample applications using the new application server WildFly. Table of Contents (11 chapters) close close close Preface Icon Preface Icon What this book covers Icon What you need for this book Icon Who this book is for Icon Conventions Icon Reader feedback Icon Customer support Lock Free Chapter 1 1. Hello World – A Cross-platform Game Icon 1. Hello World – A Cross-platform Game Icon Why should I make cross-platform games? Icon What Cocos2d-JS is and how it works Icon The structure of your Cocos2d-JS project Icon Hello Cross-World Icon Preloading and adding images Icon Removing images and changing the background color Icon Summary 2 2. Adding Interactivity – The Making of a Concentration Game Icon 2. Adding Interactivity – The Making of a Concentration Game Icon Creating multiple instances of game assets Icon Adding a gradient background Icon Extending the Sprite class beyond its capabilities Icon Making assets react to clicks and touches Icon Changing sprite images on the fly Icon Shuffling the tiles and adding the score Icon Summary 3 3. Moving Sprites Around the Screen – An Endless Runner Icon 3. Moving Sprites Around the Screen – An Endless Runner Icon Loading and placing graphic resources Icon Adding an endless scrolling background Icon Adding the spaceship Icon Controlling the spaceship Icon Adding asteroids Icon Asteroid versus spaceship collision Icon Invulnerability Icon Preventing the spaceship from flying off the screen Icon Adding particles Icon Summary 4 4. Learn about Swipes through the making of Sokoban Icon 4. Learn about Swipes through the making of Sokoban Icon Loading graphic assets Icon Building a level Icon Detecting swipes Icon Completing the game Icon Summary 5 5. Become a Musical Maestro Icon 5. Become a Musical Maestro Icon Choosing sounds Icon Preloading sounds Icon Creating a sound menu Icon Managing music and sound effects Icon Summary 6 6. Controlling the Game with Virtual Pads Icon 6. Controlling the Game with Virtual Pads Icon Overview of virtual pads Icon First things first – the game Icon Summary 7 7. Adding Physics to Your Games Using the Box2D Engine Icon 7. Adding Physics to Your Games Using the Box2D Engine Icon Before you start Icon Adding the Box2D engine to your project Icon Configuring the physics world Icon Adding bodies to the world Icon Updating sprite position as the world changes Icon Selecting and destroying world bodies Icon Checking for collisions among bodies Icon Summary 8 8. Adding Physics to Your Games Using the Chipmunk2D Engine chevron up Icon 8. Adding Physics to Your Games Using the Chipmunk2D Engine Icon Adding the Chipmunk2D engine to your project Icon Configuring the physics space Icon Adding bodies to the space Icon Selecting and destroying space bodies Icon Checking for collisions among bodies Icon Using your own graphic assets Icon Summary 9 9. Creating Your Own Blockbuster Game – A Complete Match 3 Game Icon 9. Creating Your Own Blockbuster Game – A Complete Match 3 Game Icon Setting up the game Icon Where to go now Icon Summary 10 Index Icon Index close close Customer Reviews 3.9 (11) 5 star 45.5% 4 star 18.2% 3 star 18.2% 2 star 18.2% 1 star 0% Icon Icon

Adding the Chipmunk2D engine to your project

As we will create the same game as the one in the previous chapter, I suggest you copy your project into a new folder since we will reuse most of the code already written in the previous chapter. All graphic assets will not change, so simply don't touch the assets folder. The same thing goes for the loadassets.js, main.js and project.json files.

So basically, the only file we will change is gamescript.js. Get ready to dive into the Chipmunk2D world.

A physics game, without physics

As we already built the Totem Destroyer game prototype, we can strip all the physics parts out of it and leave just the bare bones, where we will build the new physics engine.

The physics-stripped version of gamescript.js is:

var gameScene = cc.Scene.extend({ onEnter:function () { this._super(); gameLayer = new game(); gameLayer.init(); this.addChild(gameLayer); } }); var game = cc.Layer.extend({ init:function () { this._super(); var backgroundLayer... Visually different images Read this chapter and the full book FREE of cost - No Credit card required! Plus access over 8,000 other expert tech books and videos just by signing up - No commitment! CONTINUE READING 83 Tech Concepts 36 Programming languages 73 Tech Tools Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos. Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech. Icon 50+ new titles added per month and exclusive early access to books as they are being written. Learning Cocos2d-JS Game Development Previous Section End of Section 8 Next Section notes bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

Small Default Large Largest margin-width Margin width

Change margin width

Narrow Default Wide day-mode Day/Sepia/Night Modes

Change background colour

Day day-mode Sepia sepia-mode Night night-mode Close icon Search Country selected Close icon Your notes and bookmarks All Bookmarks Notes

Confirmation

Modal Close icon claim successful Order Page Read Now

Buy this book with your credits?

Modal Close icon Are you sure you want to buy this book with one of your credits? Close YES, BUY

Submit Your Feedback

Modal Close icon Submit ✓ Thanks for your feedback.

Create a Free Account To Continue Reading

Modal Close icon Google Sign Up/In with Google Github Sign Up/In with Github OR
    First name is required.
    Last name is required.

The Password should contain at least :

  • 8 characters
  • 1 uppercase
  • 1 number
Notify me about special offers, personalized product recommendations, and learning tips By signing up for the free trial you will receive emails related to this service, you can unsubscribe at any time By clicking ‘Create Account’, you are agreeing to our Privacy Policy and Terms & Conditions Create Account Already have an account? SIGN IN

Sign in to activate your 7-day free access

Modal Close icon Google Sign Up/In with Google Github Sign Up/In with Github OR
By redeeming the free trial you will receive emails related to this service, you can unsubscribe at any time. Sign In Forgot Password?

Từ khóa » Chipmunk2d