The Essential Guide to HTML5

(Greg DeLong) #1

CHAPTER 4



  • A slingshot. The parameters of flight are determined by the player dragging, then releasing a
    ball shape tethered to a stick drawing representing a slingshot. The speed is determined by the
    distance from the ball to a place on the slingshot. The angle is the angle from the horizontal of
    this part of the slingshot.


Figure 4-1 shows the simple (no cannon) application.


Figure 4-1. The ball lands on the ground.


Figure 4-2 shows the opening screen for the second application. The target is an Image and the rectangle
representing the cannon can be rotated. Notice the controls refer to an angle and an initial velocity

Free download pdf