Tech/LxEngine/Samples/Cube Rain
From Athile
Overview
The application is a tech demo that shows a 'rain shower' of small cubes falling from above and bouncing off a set of larger cubes and each other. The user can control the intensity level of the rain, a wind factor affecting the rain, as well as causing the ground cubes to appear/disappear.
Plays music in the background and a brief sound on appearance/disappearance of large cubes.
Demonstrates graphics, physics, and sound.
Technical Overview
The application either loads a template document or a saved document. Most of the logic is in the template document scripts.
The template document contains:
- 9 Elements under the root document: one for each large cube, with cube organized in a 3x3 grid about the origin
- 1 Script on Document keypress slot: hooks number keys 1-9 to control the on/off display of each cube
- 1 Script on Document keypress slot: hooks R to cycle through off, low, medium, high intensity rain
- 1 Script on Document keypress slot: hooks T to cycle through off, low, medium, high intensity wind
- 1 Script on Document keypress slot: hooks CTRL+S to save the document
- 1 Script on Document load slot: adds a per-frame fade-in affect on the overall image
- 1 Script on Document frame slot: randomly modulates wind direction and strength every frame