When you plan your script, ask yourself, when does the thing you want to happen occur? This is where events come into play. There is a large selection of pre-defined events, including When World is Started, Object Collisions, Enter and Exit events. We can even get events from when a player presses one of their controller’s buttons. For even more control we can create custom events, and cause the event to go off by either sending an event to another object, or on a delay.
Now that we know when something should happen, we can put other codeblocks into our events. There are endless possibilities, and one key to unlocking this power is using Control codeblocks like If and While. Later in this series we’ll be showing you more on how to use these.