Game Development Reference
In-Depth Information
Figure 7-21. A screen shot of the Free-Throw Game
The hoop is assumed to have a radius of 0.23 m and the ball a radius of 0.12 m . For a shot
to be good, the center of the ball must travel to within 0.14 m of the center of hoop. This value
represents the difference in radius between the hoop and ball plus a 0.03 m “fudge factor” to
account for glancing collisions where the ball would still fall through the hoop. Backboard
collisions are assumed to be frictionless. The coefficient of restitution between the ball and
backboard is assumed to be 0.75. A constant drag coefficient of 0.5 is used for the basketball.
One nice thing about the Free-Throw Game is that we do not have to write a class that
models a basketball. We can simply use the DragProjectile class we developed in Chapter 5,
which has all of the elements required to model the flight of a basketball. The FreeThrow class
that defines the GUI for the application is very similar to the other GUI classes in this chapter.
The FreeThrow class code listing can be downloaded from the Apress website.
Baseball
Most cultures invent a game that involves hitting a ball with a stick. In the middle part of the
nineteenth century, Americans began to modify an English game called rounders into what
would become baseball. In 1845 Alexander Cartwright (not Abner Doubleday as is commonly
believed) wrote down a series of rules to govern team baseball. Many of these rules are still in
use today.
The first recorded baseball game took place in 1846 between the New York Knickerbockers
and the New York Baseball Club. The first organized baseball league formed in 1857, but the
first completely professional team, the Cincinnati Red Stockings, did not appear until 1869.
Baseball has a rich and storied history over the past 160 years and is played in countries all over
the world today.
Equipment Specifications
A baseball, as shown in Figure 7-22, is made from yarn tightly wound around an inner core of
cork. The outer cover of the ball is two dumbbell-shaped pieces of horsehide or leather that are
stitched together to form a spherical shape. The seams are used to help grip the ball and are
also employed by pitchers to put different types of spin on their pitches.
Search WWH ::




Custom Search