Game Development Reference
In-Depth Information
So, rather than making a pointless list of all possible Box2D joints, I will show you
something that is strictly related to game development: a siege machine.
When Angry Birds meets Crush the
Castle
What if birds had a siege machine? Let's explore this gameplay, but first let me explain
which kind of siege machine I want to build using only distance and revolute joints.
The siege machine consists of two carts mounted on wheels. The first cart can be
controlled by the player and acts as a truck tractor. The second cart is just a trailer
but has something between a trebuchet and a morning star mounted on it.
A bit confused? Let me show you the prototype:
There is a lot to do, so let's start running. What do we need to include in our package?
1.
First, the same old classes, Joints included:
import flash.display.Sprite;
import flash.events.Event;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
2.
And obviously the class-level variables you are already used to now:
private var world:b2World;
private var worldScale:Number=30;
 
Search WWH ::




Custom Search