
Box2D for Flash Games
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
- Build and destroy levels piece by piece
- Create vehicles and bring them to life with motors
Book DescriptionPhysics games are getting more and more popular, and Box2D is the best choice if you are looking for a free, stable and robust library to handle physics. With Box2D you can create every kind of 2D physics game, only coding is not the fun part, but the game itself. "Box2D for Flash Games" will guide you through the process of making a Flash physics game starting from the bare bones and taking you by hand through complex features such as forces, joints and motors. As you are learning, your game will have more and more features, like the physics games you are used to playing. The book analyzes two of the most played physics games, and breaks them down to allow readers to build them from scratch in a step-by-step approach. By the end of the book, you will learn how to create basic primitive bodies as well as complex, compound bodies. Motors will give life to cars, catapults and siege machines firing bullets, while a complete collision management will make your game look even more realistic. If you want to make full Flash games with physics, then Box2D for Flash Games will guide you through the entire process of making a Flash physics game.What you will learn - Create a physics world with gravity
- Manage materials assigning physics properties
- Interact with physics bodies using mouse or keyboard
- Build vehicles with joints and motors
- Handle every kind of collision
- Add forces and impulses to bodies
- Turn your graphic assets into physics bodies
- Fire bullets and destroy bodies
Who this book is forAre you familiar with ActionScript3 and want to explore the capabilities of physics in game design using Box2D, then this book is for you. You don't have to be an AS3 hero: if you know how to create classes and functions with AS3, then you can make your first physics game!
All prices
More details
Other editions
Additional editions

Content
- Intro
- Box2D for Flash Games
- Table of Contents
- Box2D for Flash Games
- Credits
- About the Author
- About the Reviewers
- www.PacktPub.com
- Support files, eBooks, discount offers and more
- Why Subscribe?
- Free Access for Packt account holders
- Preface
- What this book covers
- What you need for this book
- Who this book is for
- Conventions
- Reader feedback
- Customer support
- Downloading the example code
- Errata
- Piracy
- Questions
- 1. Hello Box2D World
- Downloading and installing Box2D for Flash
- Hello Box2D World
- Defining the Box2D World
- Running the simulation
- Summary
- 2. Adding Bodies to the World
- Your first simulation - a ball falling on the floor
- Creating a circular shape
- Creating a fixture
- Using debug draw to test your simulation
- Creating a box shape
- Different body types - static, dynamic, and kinematic
- Density, friction, and restitution
- Creating a Totem Destroyer level
- Creating compound bodies
- Creating an oriented box shape
- Creating any kind of convex polygons
- Summary
- 3. Interacting with Bodies
- Selecting and destroying bodies with a mouse click
- Assigning custom attributes to bodies
- Looping through bodies and getting their properties
- Summary
- 4. Applying Forces to Bodies
- Falling apples, revamped
- Force, impulse, and linear velocity
- Applying an impulse to get a linear velocity
- Applying a force to get a linear velocity
- Forces in a real game
- Physics games aren't just a matter of physics
- Placing the physics bird
- Shooting the physics bird
- Summary
- 5. Handling Collisions
- Checking for collisions
- Box2D built-in collision listener
- Trace the beginning and the end of a collision
- Detect when you are about to solve a collision and when you have solved it
- Detecting when the idol falls on the floor in Totem Destroyer
- Destroying bricks and killing pigs in Angry Birds
- Summary
- 6. Joints and Motors
- Picking and dragging bodies - mouse joints
- Keeping bodies at a given distance - distance joints
- Making bodies rotate around a point - revolute joints
- When Angry Birds meets Crush the Castle
- Controlling joints with motors
- Controlling motors with keyboard
- Don't let some bodies collide - filtering collisions
- Putting it all together
- Summary
- 7. Skinning the Game
- Replacing debug draw with your own graphic assets
- Summary
- 8. Bullets and Sensors
- Experiencing tunneling
- Preventing tunneling - setting bodies as bullets
- Allow bodies to overlap while detecting contacts with sensors
- Summary
- Index
System requirements
File format: ePUB
Copy protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePub works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our ebook Help page.
File format: PDF
Copy-Protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (only limited: Kindle).
The file format PDF always displays a book page identically on any hardware. This makes PDF suitable for complex layouts such as those used in textbooks and reference books (images, tables, columns, footnotes). Unfortunately, on the small screens of e-readers or smartphones, PDFs are rather annoying, requiring too much scrolling.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our eBook Help page.