HTML and CSS Reference
In-Depth Information
Classified intel
The resituion deines how bouncy an object is when it interacts with another object.
This value is usually between 0 and 1. The bounciness is decided by the resituion values
of two colliding objects. Speciically, Box2D sets the resituion value to the maximum value
of both the colliding objects. In such a mechanism, we define the hoop board to have a
small resituion value. The bounciness result will be determined by the ball, which will
have diferent values that are higher than the resituion of the board.
Designing the physics world
Deining the object placement purely in code can be quite diicult someimes. We need to
align the objects in code with our imaginaion. By using a visual editor, we can make the
design process easier.
I usually take the following approach. I launch any graphical editor and set the dimension
to match the game canvas. Next, I put a similar rectangle in the art board to get the posiion
value. Then, I can easily grab the posiion value from the art board and put the value in
the code.
Ater this, I place the posiion's value in the code with the Box2D body type.
If you need a more advanced physics editor for a complex scene, there are several visual
editors on the Web. The following are some of them:
F The Box2D editor ( )
F The Physics editor ( )
F The RUBE editor ( )
Adding a launch bar with power
The player doesn't know how much power needs to be applied to the ball. This will lead to
confusion. We can improve this by displaying a power indicator when shooing the ball.
Prepare for lift off
We will create the hierarchy directly from Flash. The following screenshot shows the
symbol hierarchy:
Search WWH ::

Custom Search