Now we have imported the graphics and the sounds, we need to add some functionality to the game.
At the moment we have all the elements – but they aren’t yet doing anything. Therefore we are going to use the Event Sheet (which we covered in detail in the Foundations tutorials).
Adding Functionality
Before we can start setting up the events, we need to create add the functions to make these happen. Events are a combination of a condition and the resulting action. An example of an event would be ‘when a carrot is clicked’ (this is the condition), ‘play a sound’ (this is the action). Therefore we need to add Touch and Audio functionality to allow for clicks/taps and audio playing.
Touch functionality will recognize when an object is either clicked or tapped and we Audio will play a sound based on certain conditions.
These are added as Objects and to add these, right click on the layout and from the object panel which opens, select Touch (either scroll down and look for the Touch icon or start typing the word into the search box to narrow the options).
Repeat the process to add Audio.
If you look at the project bar on the right, you will see the Touch and Audio icons which tell you this functionality has been added to the project.