Box2D for Flash Games by 2012
Author:2012
Language: eng
Format: epub
Publisher: Packt Publishing
And as said, here is your Angry Birds level. Still no pigs and camera following the bird, but you'll learn how to do it in the coming chapters.
Summary
In this chapter you learned how to use forces to move bodies in your Box2D world. There's a lot of stuff you can do by applying forces. From a platformer to a pool game, every physics game where the player can move a body in some way implies the use of a force, and now you know how to apply them.
Chapter 5. Handling Collisions
Given a Box2D world and some moving bodies, sooner or later two of them will collide. Physics games rely on collisions for most gameplay features. When a bird smashes pig's castle in Angry Birds, it is thanks to collisions; when the idol falls down the totem and breaks on the ground, that's due to collisions.
Box2D already does all the required tasks to solve collisions and run the simulation without any coding on our part. By the way, in some situations, we need to interact with collisions for a gameplay purpose.
Think about Angry Birds, hitting hard on a wooden wall will break it, but normal Box2D collision routines do not manage wooden wall breaking. Moreover, if the Totem Destroyer idol hits the ground, the level fails but again Box2D just manages the collisions without caring about the gameplay rules.
That's why sometimes we need to analyze collisions, and luckily Box2D allows us to do it thanks to contacts: objects created by Box2D to manage collisions between two fixtures.
In this chapter you will learn how to handle collisions using contacts, and among other things:
Creating a custom contact listener
Determining which bodies are colliding
Determining how hard was a collision
Looping through all collisions involving a body
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Aircraft Design of WWII: A Sketchbook by Lockheed Aircraft Corporation(32134)
The Great Music City by Andrea Baker(30780)
Call Me by Your Name by André Aciman(19902)
The Art of Boudoir Photography: How to Create Stunning Photographs of Women by Christa Meola(18402)
The Secret History by Donna Tartt(18159)
Shoot Sexy by Ryan Armbrust(17556)
Plagued by Fire by Paul Hendrickson(17109)
Portrait Mastery in Black & White: Learn the Signature Style of a Legendary Photographer by Tim Kelly(16870)
Adobe Camera Raw For Digital Photographers Only by Rob Sheppard(16796)
Photographically Speaking: A Deeper Look at Creating Stronger Images (Eva Spring's Library) by David duChemin(16496)
Ready Player One by Cline Ernest(13981)
Pimp by Iceberg Slim(13777)
Bombshells: Glamour Girls of a Lifetime by Sullivan Steve(13683)
The Goal (Off-Campus #4) by Elle Kennedy(13193)
Art Nude Photography Explained: How to Photograph and Understand Great Art Nude Images by Simon Walden(12851)
Kathy Andrews Collection by Kathy Andrews(11323)
The Priory of the Orange Tree by Samantha Shannon(8608)
Thirteen Reasons Why by Jay Asher(8451)
The remains of the day by Kazuo Ishiguro(8393)
