This is a simulation of a basketball on a tilted floor. You can hit the basketball with the hand and you can tilt the floor to a different angle by clicking on it and dragging up or down.
How it works: The basketball has variables for speed in the x and y directions. The stage sends gravity messages that periodically accelerate the ball downward. When the ball hits a surface the x and y speeds are reflected according to the rules of trigonometry, and the speed is reduced by a decay factor. When the hand moves across the ball, the speed of movement of the hand in the x and y directions is detected and applied as an acceleration to the ball.
To do: change the values of gravityx and gravityy in the stage and restart to see how this affects the behavior of the ball. Can you create "flubber"?
Comments
You need to be logged in to post comments
Add a Comment