Tutorial
Page 7 of 9
The Mouse Event
Finally we need a 'When/Do' event for when the user clicks the clown...
First we will add 10 points to the score. Then we'll play the click sound, and then we will jump the clown to a random position, setting a new random direction and making him move faster.
- Press the Add Event button. In the Event Selector click on the Mouse Event and in the sub-menu that appears select Left Pressed.
- From the tab labelled Score include the Set Score action.
- As new score indicate a value of 10 and also click on the box next to the property Relative to enable it. When Relative is enabled the value is added to the current score, otherwise the
score would be replaced by the value.
- From the tab Main1 include a Play Soundaction and for the sound indicate "snd_click". Leave Loop as false.
- From the Move tab, include a Jump to Random action, which places the instance in a random, collision-free position. The parameters can be left unchanged for this action.
- Finally we include a Move Fixed action.
- Again select all eight arrows (and not the centre square) and for the speed indicate a value of 0.5 and enable the Relative property to add 0.5 to the current speed.
The finished event list should look like this:
We are now finished with the clown object. We have included actions for the three events that are important, so press the OK button to close the Object Properties window and get ready to actually see your game come to
life as we create a room and place some instances into it!
© Copyright YoYo Games Ltd. 2014 - Updated for KS3, by Mr. Robinson