HTML and CSS Reference
In-Depth Information
The following screenshot shows the game that now loads a level with a 45-degree-rotated
square obstacle:
Objective complete - mini debriefing
We have placed the obstacles in different levels. Now, we can play different levels by
providing the level number in the code.
Building the level
We used literal objects to represent levels. While we construct the world with the
createLevel method, we use the level deiniion to create the hoop, balls, and obstacles.
We didn't use much size variaion here for the obstacles because we will need graphics to
represent them later. Having too many dimensions makes the graphics preparaion more
difficult.
Besides placement, we deine diferent types of balls by seing diferent values for the
radius, density, resituion, and fricion.
With a combinaion of these four variables, we can create a wide range of diferent types
of balls. The radius afects the diiculty of hiing the hoop because of the size. The density
afects the mass and amount of power that a player needs to apply. The resituion and
fricion deines how bouncy the ball should be. Then, in each level, we deine which ball
type is used. Visually, we will use different colors for different kinds of balls. We will work
on the visual graphics in the later tasks.
 
Search WWH ::




Custom Search