Game Development Reference
In-Depth Information
This is why we introduced a new constant named ACCEL_MAX_ANGLE_MAX_MOVEMENT
that allows you to define the maximum tilt angle that is needed to reach maximum
velocity. The other new constant ACCEL_ANGLE_DEAD_ZONE is used to define a dead
zone (here 5.0 degrees) in the positive and negative directions where no movement
will occur. So, the dead zone makes it easier for the player to find a neutral position
to let the bunny head stand still. Finally, we end up with a percentage of the desired
movement stored in an amount that is simply multiplied with the terminal velocity
to calculate the correct velocity value.
Summary
In this chapter, we covered the basics of the Box2D rigid body physics engine, and
thereafter applied the newly gained knowledge, including all the individual parts
(rigid body, body type, shape, fixture, and world) by creating a believable physics
simulation of raining carrots. Also, two new game objects were added, which
represented the carrot for physics simulations and a huge golden carrot statue
symbolizing a level's goal or exit.
Then, we went down the graphics pipeline, more precisely the Programmable
Pipeline of OpenGL (ES) 2.0 to explore the use of shaders. We created our own
shader program to apply a monochrome filter effect of arbitrary intensity through
a uniform variable that can be passed to the shader program at runtime in the
application code. You learned about GLSL and created a simple pair of vertex and
fragment shaders that are used in Canyon Bunny.
Finally, you learned how to use and work with peripheral devices using the example
of an accelerometer. You also learned how to transform the data provided by a
sensor into more suitable values. These values were then used as input to create
an alternative way to control the player's movement just by tilting the screen to the
left or to the right.
In the subsequent chapters, we will add animations to the game.
 
Search WWH ::




Custom Search