1
00:00:00,840 --> 00:00:06,210
In this lecture I want to continue on with sounds by adding a enemy sounds and then our music.

2
00:00:06,240 --> 00:00:07,600
Now let's go look at our arrow.

3
00:00:07,660 --> 00:00:10,320
When an arrow gets destroyed you'd like to make a sound.

4
00:00:11,120 --> 00:00:20,940
So just under objects an arrow in the step event at the point where they are always dying.

5
00:00:21,440 --> 00:00:34,330
So I want to play the RR Di sand but only if the arrow is on screen it only hit or die if it happens.

6
00:00:34,330 --> 00:00:36,940
A few screens away and runs into a wall.

7
00:00:36,980 --> 00:00:39,980
It's just doesn't feel right to the game for us to hear that.

8
00:00:40,390 --> 00:00:47,650
So we can check if the arrows on the screen by saying if on screen you remember we have a script that

9
00:00:47,650 --> 00:00:54,040
checks if something is on screen and we have a buff of you that lets us then add a few more pixels to

10
00:00:54,040 --> 00:00:54,790
the screen.

11
00:00:54,880 --> 00:00:56,990
So then Colback on screen.

12
00:00:57,040 --> 00:01:06,220
So if on screen is 40 then we can use the same method we did before by saying the image index is equal

13
00:01:06,220 --> 00:01:07,200
to 1.

14
00:01:07,480 --> 00:01:09,000
Then we can apply the order.

15
00:01:09,250 --> 00:01:13,460
We don't want to do it at any other time because we only want to play once.

16
00:01:13,570 --> 00:01:23,990
So now we can play the sandhi it's going to be aero Di and only the pro already at 20 when there is

17
00:01:23,990 --> 00:01:25,870
fire under our sport.

18
00:01:25,910 --> 00:01:27,450
Let's add one to that as well.

19
00:01:29,770 --> 00:01:30,460
We're going to put down

20
00:01:34,390 --> 00:01:38,710
and we just want the sound of our firing.

21
00:01:38,890 --> 00:01:41,310
And I just it a party of 10.

22
00:01:41,320 --> 00:01:43,370
Now what about when the enemies attack the player.

23
00:01:44,900 --> 00:01:49,960
So let's look at the enemy attack script which is process enemy attack.

24
00:01:50,100 --> 00:01:56,420
And if we look down here we're green Cheick happens and we're going to put on the bat and sand here

25
00:01:57,090 --> 00:02:04,060
and we just want to play the sound of the player being hit play a hit.

26
00:02:04,420 --> 00:02:08,640
And I'll give it a property of 40 because it's quite important to see when you're being hit.

27
00:02:08,860 --> 00:02:12,150
Now just like the player attack there's also a chance the blocking occurs.

28
00:02:12,170 --> 00:02:15,440
So down heah latera sound.

29
00:02:15,580 --> 00:02:21,460
And this is where the blocking happens so we just put the blocks down here and we're going to give that

30
00:02:21,460 --> 00:02:23,050
a party of 40 as well.

31
00:02:23,050 --> 00:02:31,340
Now where the enemies die which happens under enemy hate you pay so you can just place that he when

32
00:02:31,380 --> 00:02:36,110
play the death sound I'll say what I play sound.

33
00:02:36,240 --> 00:02:41,880
We have one cold enemy dying and we give that a party of 10.

34
00:02:42,140 --> 00:02:45,440
But as well as that remember these gems dropped out of the enemy's.

35
00:02:45,630 --> 00:02:49,820
So let's play a jam spoon sound.

36
00:02:49,950 --> 00:02:54,110
But I want to play it once so I'm not going to put it down here amongst this section.

37
00:02:54,210 --> 00:02:55,760
We'll just play it here once.

38
00:03:00,240 --> 00:03:05,840
And give your 15 says those are a spawn of help here.

39
00:03:05,860 --> 00:03:07,730
So let's give a sample of that as well.

40
00:03:10,370 --> 00:03:13,540
And HP scoring.

41
00:03:13,910 --> 00:03:16,880
And we'll just add that as 15 as well.

42
00:03:16,880 --> 00:03:23,780
So let's have a look at our frog and the frog jump start state where the frog actually does jump.

43
00:03:23,780 --> 00:03:26,750
Let's play a sound for the frog jumping.

44
00:03:26,800 --> 00:03:33,420
So just when he is where that happens and the same as with the arrow I don't want to hear the frog jumping.

45
00:03:33,430 --> 00:03:40,420
If he's not on the screen so if on screen and we use the same buffer as 40 will then we can play the

46
00:03:40,420 --> 00:03:40,950
sound

47
00:03:43,720 --> 00:03:50,270
and just called frog jump and just put a party 20.

48
00:03:50,280 --> 00:03:53,200
Now let's have a look where the frog actually does the attack.

49
00:03:53,670 --> 00:03:59,610
So once again we only want to play it on that first frame so he can come in here and say it's image

50
00:03:59,730 --> 00:04:02,620
index is equal to five.

51
00:04:02,940 --> 00:04:10,890
Then we want to play the sound of a frog attacking and I'll give it a property of 15.

52
00:04:10,900 --> 00:04:16,130
Now what about a chest or chest opens up and the gems pop out.

53
00:04:16,190 --> 00:04:17,560
So that happens in here.

54
00:04:18,520 --> 00:04:24,430
So after gems are created the have a say on here I'm going to do something here to change the sound

55
00:04:24,430 --> 00:04:25,470
of the jams.

56
00:04:25,510 --> 00:04:29,420
I'm going to vary the pitch when they spawned.

57
00:04:29,630 --> 00:04:35,420
And by that I mean if I have the same sound when they all come and this will sound a little odd so I'm

58
00:04:35,420 --> 00:04:40,730
going to set a variable called S&amp;P and I'm going to set a sound to that variable

59
00:04:44,290 --> 00:04:45,730
and I'll have 15.

60
00:04:45,940 --> 00:04:52,840
And by setting that like that I can then use audio on the school sound on the pitch and I can change

61
00:04:52,840 --> 00:04:54,700
the pitch of a sound.

62
00:04:54,760 --> 00:05:00,550
And in this case it's going to be Sandy and the pitches only set to one so we can change it by using

63
00:05:00,940 --> 00:05:09,350
a random range and just have a go between 0.9 and 1.1 and that'll just vary it slightly.

64
00:05:09,370 --> 00:05:11,050
Now when the play starts the game.

65
00:05:11,140 --> 00:05:19,810
So we got to our game we got gradual gooey and we go to where the player actually clicks start.

66
00:05:20,160 --> 00:05:21,660
Just in here.

67
00:05:22,390 --> 00:05:29,010
So we can have a sound that makes the game start at that point and we get the game start now to set

68
00:05:29,040 --> 00:05:31,480
to 15.

69
00:05:31,530 --> 00:05:36,560
Let's go to the bug and at the point where he actually spots the player.

70
00:05:36,800 --> 00:05:42,120
So in the Idol where he actually sees the player for the first time let's make a sound.

71
00:05:42,170 --> 00:05:44,350
So the player knows that he's been spotted.

72
00:05:45,850 --> 00:05:53,560
So right here we just have one called Bug C's player and all set to 40 codes important to play and knows

73
00:05:53,990 --> 00:05:55,250
that that's happened.

74
00:05:57,030 --> 00:06:02,070
I'm going to take a copy of that because we also want that in the petrol state at the point he where

75
00:06:02,070 --> 00:06:03,350
he sees the player.

76
00:06:03,780 --> 00:06:08,230
So once you're in the chase state I want him to make a sound while chasing the player.

77
00:06:08,520 --> 00:06:15,360
So when he we can just add a and doesn't really matter way down here.

78
00:06:15,730 --> 00:06:21,800
But once again we don't want this to play every single step otherwise we're going to have to sound overlapping.

79
00:06:21,850 --> 00:06:23,950
We need to check that it's not playing.

80
00:06:24,040 --> 00:06:34,220
So it's not audio is playing and the sound is called Sound bug chase we'll then we can play it

81
00:06:38,080 --> 00:06:40,840
and slow the property a little bit for that.

82
00:06:40,840 --> 00:06:47,310
Now the last thing I want to do is add the music so we can do that by going to a game and going to a

83
00:06:47,310 --> 00:06:49,130
room stopped.

84
00:06:49,180 --> 00:06:52,220
So let's head down here how to play the music.

85
00:06:52,270 --> 00:06:54,190
Now we just need to drag the music in.

86
00:06:54,460 --> 00:06:58,240
So just on the music take these two drag the mean

87
00:07:01,700 --> 00:07:05,740
those two different tunes is one for when you normally playing in one for the end line.

88
00:07:06,210 --> 00:07:18,960
So if our room is equal to room game and then we want to stop the game music and we want to play the

89
00:07:19,050 --> 00:07:21,180
end game music.

90
00:07:22,520 --> 00:07:32,920
Or else we just want to play the game music because we do that when we can stop it by saying audio stop

91
00:07:33,620 --> 00:07:38,690
sound and the sound is called Sound on disco music.

92
00:07:38,870 --> 00:07:41,660
Middle Park.

93
00:07:41,820 --> 00:07:44,330
And then we want to play the music.

94
00:07:44,340 --> 00:07:53,010
So sound music gaming and so just keep that approach to attain.

95
00:07:53,250 --> 00:07:59,280
Now down here if the room is not the room game and will that's any other time during the game we just

96
00:07:59,280 --> 00:08:01,830
want to play the normal music but we don't want to play it.

97
00:08:01,870 --> 00:08:03,520
If it's already being played.

98
00:08:03,810 --> 00:08:12,220
So we need to say if not audio is playing of sound and music.

99
00:08:12,320 --> 00:08:14,590
Middle Park will be in.

100
00:08:14,630 --> 00:08:21,620
We can play it.

101
00:08:21,770 --> 00:08:23,850
So I'm going to give that a party of 20.

102
00:08:23,870 --> 00:08:26,290
Now the other thing I want to change is the false.

103
00:08:26,300 --> 00:08:32,090
I want to change to a true which means the music will loop after it finishes.

104
00:08:32,150 --> 00:08:33,220
So let's test it out.

105
00:08:37,870 --> 00:08:40,530
Starting sound.

106
00:08:40,580 --> 00:08:43,750
And what a difference it makes to the game just to hear those sounds to me.

107
00:08:56,210 --> 00:08:57,180
Yeah that's right.

108
00:08:57,210 --> 00:08:58,360
Just hear this Sam

109
00:09:01,240 --> 00:09:08,070
and hear the different pitch in those jams just gives us some variety when it's opening and arises as

110
00:09:08,070 --> 00:09:10,200
well that's all looking really good.

111
00:09:11,150 --> 00:09:12,170
So that's all for this lecture.

112
00:09:12,170 --> 00:09:12,800
Thanks for joining me.

113
00:09:12,800 --> 00:09:13,760
I'll talk to you in the next.

