Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Box2D for Flash Games

You're reading from  Box2D for Flash Games

Product type Book
Published in Nov 2012
Publisher Packt
ISBN-13 9781849519625
Pages 166 pages
Edition 1st Edition
Languages

Table of Contents (15) Chapters

Box2D for Flash Games
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Hello Box2D World 2. Adding Bodies to the World 3. Interacting with Bodies 4. Applying Forces to Bodies 5. Handling Collisions 6. Joints and Motors 7. Skinning the Game 8. Bullets and Sensors Index

Replacing debug draw with your own graphic assets


This may seem obvious, but in order to replace debug draw with your graphic assets, you will need to draw some graphic assets.

So the first question is, how many sprites do I need to draw?

Let's make a list of the actors in the Totem Destroyer game:

  • Two 30 x 30 pixels breakable bricks

  • One 120 x 30 pixels breakable brick

  • One 90 x 30 pixels breakable brick

  • One 60 x 30 pixels unbreakable brick

  • One 120 x 60 pixels unbreakable brick

  • The floor

  • The idol

So these are the graphic assets we need to draw. Remember to draw them with the registration point at the center, to match body origin, and also remember to export them for ActionScript.

Get the latest Totem Destroyer project and start drawing. The following screenshot shows my library window. Please notice the names under AS Linkage as I will be using them in the code.

The idea is simple, we are going to use custom user data to store and handle sprites.

  1. So the first step is changing how the Main function calls...

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 €14.99/month. Cancel anytime}