This example builds on Example 1 (original project) and bounces a circle in a randomly placed rectangle, smaller than the stage. See inside, and the even simpler original project. All code by me (@kriblo).