All language subtitles for 23. Tidy Up & Death FX

af Afrikaans
ak Akan
sq Albanian
am Amharic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

1 1

[MUSIC] 2

2

Hello again, in this video, we're gonna do a little bit of tidying up of our code, 3

3

and we're gonna implement a death particle effect when the attackers are smashed into 4

4

oblivion. 5

5

So let's start by opening our projectile script. 6

6

We can see in here that we've got a variable for health, and 7

7

we've got our health dealing damage. 8

8

What I'm going to do is create another variable that allows us to have 9

9

a mechanism to say what is the health, sorry, what is the attacker, I was looking 10

10

at the one above, we've already got the health, Rick, what are you thinking? 11

11

We want to be able to reference the attacker, and 12

12

that's going to equal otherCollider.GetComponent< >, 13

13

and what do we put within our angle brackets here? 14

14

We put <Attacker>. 15

15

You guessed it. 16

16

Hopefully you guessed it. 17

17

Yelling out at the screen randomly, attacker. 18

18

Okay, so now that we have those two I'm gonna create an if statement 19

19

here where I say if(attacker &&), so double ampersand, 20

20

that's what that thingy is, the and sign is an ampersand. 21

21

So &&, say that fast ten times, health. 22

22

So that's saying that when we're colliding with something, 23

23

if it has the attacker component, and it has the health component, 24

24

if both of those are true, then we want to do something. 25

25

What is it that we wanna do? 26

26

Well, we want to do our health.DealDamage. 27

27

That would be the first thing, and then also, I think what we want to do is 28

28

destroy the projectile so that it's not hanging around. 29

29

You could have it that when your enemy shoots, 30

30

you have a slow projectile that goes through and does damage to everyone, 31

31

one of those like rockets that cannot be destroyed, but for us, or for 32

32

the zucchini I want it to hit and then to go away, I think that makes more sense. 33

33

So, what do we type in here if we want to destroy the projectile? 34

34

We type in Destroy(gameObject). 35

35

So destroy our cell, save that up. 36

36

So now, it should only be colliding with the correct things. 37

37

We probably won't see much of a change, cuz it's not passing through any of 38

38

the incorrect things, but we know that if there was another cactus in front of it, 39

39

then it wouldn't bump into that point. 40

40

Boink, there we go, we hit once, and we hit twice, and it's disappearing. 41

41

Excelente! 42

42

The moment of disappearing where the attacker is killed is a little bit bland, 43

43

so we're gonna spruce that up a little bit by putting in a particle effect. 44

44

And this where I've got a challenge for you is to create a nifty 45

45

particle effect and to trigger that when the attacker is killed. 46

46

So this is code that we've done before. 47

47

It should be pretty straightforward for you to find where to put that code and 48

48

say, how do I trigger this particle effect so that it happens, and 49

49

if you don't wanna create a particle effect, then I've got one that I'm using. 50

50

Just one of our other projects in this course that I can give to you as 51

51

downloadable against this lecture. 52

52

So you can grab that, if you like, as a asset pack or you can make your own. 53

53

So jump in, take on that challenge. 54

54

I'll see you back here when you've given it your best shot. 55

55

Okay, let's go and grab that asset. 56

56

So I've got ExplosionVFX. 57

57

When I drag it in anywhere into my Assets folder it asks me whether I'd like 58

58

to import. 59

59

Yes, I import, and it brings in the folder structure as well, so 60

60

I've got this VFX folder down here with the Explosion VFX, 61

61

[LAUGH] which you might recognize from one of the other sections of the course. 62

62

I've just gone and grabbed it. 63

63

You can take plenty of time to finesse with your particle effect but 64

64

I'm not gonna go through that in too much detail. 65

65

I just wanted to get something that we could use for now. 66

66

Let's just have a look, make sure it works. 67

67

Boink, there we go. 68

68

It's kind of stars going a bit crazy. 69

69

Good enough. 70

70

Job done. 71

71

Okay, so let's go over into our health script. 72

72

Above Destroy, we need a notion of calling a method where 73

73

we're going to say TriggerDeathVFX(). 74

74

Okay, we wanna trigger the VFX and then we want to destroy it ourselves, 75

75

in this case it's destroying the lizard, and 76

76

we want to make sure that the DeathVFX isn't destroyed as well. 77

77

So that's a little bit trickier. 78

78

This is why we need to instantiate, rather than just playing a VFX, 79

79

rather than just playing a particle effect on, where's one of my lizards here? 80

80

Prefab > Lizard, drag them into the scene so we put him there. 81

81

So we could have as a child, we could have a particle effect under the lizard. 82

82

But then when we destroy the lizard, we're also destroying the child, 83

83

the particle effect underneath that. 84

84

So we're create ourselves a private void TriggerDeathVFX. 85

85

What do we want to do in here? 86

86

Well, first of all I'm gonna say, if we don't have any VFX, then just return, 87

87

just in case we forget to put something on there, 88

88

we don't want something to break where it says, hey, 89

89

trigger a particular particle effect and we've kind of forgotten. 90

90

I know that you would never forget to do that, but 91

91

I forget to do these things sometimes. 92

92

So say, if there is no, what are we going to call this? 93

93

We'll call this deathvfx, we're going to make that variable in a moment, 94

94

then just return. 95

95

Just go about your business, don't worry, don'tdon't stress about it. 96

96

Unity, everything will be fine. 97

97

So let's go and serialize ourselves a variable, 98

98

[SerializeField] GameObject, cuz we want to be able to 99

99

reference it as a GameObject in a moment, and it's a deathVFX. 100

100

Okay, so now we have this notion of we're gonna drag in our deathVFX, 101

101

that we just brought in, the explosion thing I had before. 102

102

If it doesn't exist, if you don't have one of these then don't worry about it, 103

103

just return it. 104

104

Otherwise, what are we gonna do? 105

105

Well, we'll start off just by saying, instantiate. 106

106

Instantiate, what do we need to do here? 107

107

Well, we're gonna instantiate(deathVFX, ). 108

108

We've done this a bunch of times when instantiating. 109

109

It should be pretty natural by now. 110

110

And then where is it? 111

111

It's transform.position. 112

112

Had to think for a moment there. 113

113

And then we can do transform.rotation, or we can do the quotidian.identity. 114

114

I just like doing transform.rotation when it doesn't really matter what our 115

115

rotation is, we're just putting it in there so that this instantiates happy, 116

116

it's not confused saying what's the rotation, Rick? 117

117

Okay, let's see how this goes, if this works. 118

118

Jump back over, we need to create that reference. 119

119

So on Lizard, we should now see, on our health script, 120

120

we can see it's looking for deathVFX whereas my VFX, 121

121

I will grab Explosion VFX, drag it on over into there. 122

122

Click on play just to make sure that this works. 123

123

He jumps out, shoot, bang, and one more time, shoot, bang, [SOUND]. 124

124

Okay, we didn't get a VFX, why is that? 125

125

Well let's go to our Explosion VFX, it's probably, 126

126

if we scroll down down down to the renderer, we can see, if we look closely, 127

127

the Order in Layer is 0, so we've gone through that before. 128

128

I'll put this at 6 so it sits over the top of everything. 129

129

That's right on the prefab, so that should be applied to what we're calling. 130

130

Okay, we'll try this again. 131

131

Okay, it's jumps out. 132

132

[SOUND] You know what I'm gonna do? 133

133

This has [LAUGH] been bugging me for awhile. 134

134

I don't know, I haven't done this. 135

135

I'm gonna click on my lizard. 136

136

Go down, instead of 100 health, I'm gonna give you 30 health, so 137

137

you get shot and killed. 138

138

I'm gonna click apply, shot and killed with one shot. 139

139

Now if we want to see how it works with multiple shots then we'll put that back up 140

140

again, but for now. 141

141

Kaboom, there we go, nice, and it created a particle effect. 142

142

Let's have a look in here. 143

143

We've got this Explosion VFX, now that's gonna 144

144

stick around forever if we don't take care of it, so let's go take care of it. 145

145

How do we take care of it? 146

146

Well, we need to destroy the particle effect and 147

147

this is why we're instantiating. 148

148

Sorry, we're instantiating because the lizard gets destroyed, 149

149

and this creates this whole new game object here, but we need a handle to it, 150

150

we need a way of referring to this game object. 151

151

So we'll create ourselves a GameObject type called deathVFXObject, 152

152

and that's equal to what we've just instantiated. 153

153

So now we have this notion of there's a deathVFXObject, 154

154

so on our next line we can say Destroy(deathVFXObject), 155

155

and we have the option of saying after how long. 156

156

We don't wanna destroy it straight away, because we need to actually see 157

157

the particle effects, so we'll say after a second. 158

158

This is a little bit of a magic number in here, but I'm okay with that. 159

159

We could put it to 10 and be super safe, but I'll leave it at 1. 160

160

I'm pretty sure my particle effect is gonna be come and 161

161

gone in one second no problem. 162

162

So we'll make sure all that works and is hunky dory. 163

163

Click on play, watch our hierarchy, lizard's being spawned, blump, 164

164

explosion, and then the explosion went away. 165

165

Now, if you look at it closely, I think, here we go, when it hits, 166

166

when it strikes, boink, the particle effect is a little bit to the right. 167

167

It looks a little bit off. 168

168

It's all going pretty quick so you don't really notice it, but 169

169

there's a few ways to solve this. 170

170

For now, I'm going to be a little bit cheeky, okay, and for the [LAUGH] 171

171

experienced programmers out there you're gonna be like,what are you doing? 172

172

I'm gonna be a little bit cheeky and 173

173

show you how I will move the particle effect as opposed to trying to 174

174

reposition it on the lizard, or on the lizard's pivot point. 175

175

So you see the pivot point there. 176

176

Instead of trying to change where we instantiate it I'm just gonna change 177

177

the particle effect a little bit. 178

178

So forgive me on this that it's not perfect, but sometimes I think it's good 179

179

to do these little tweaks so that we can keep on moving. 180

180

So let's find our VFX > Explosion VFX, Drag one of those into the scene. 181

181

You can see here is the particle effect. 182

182

If we zoom in, this little symbol is showing it, and 183

183

that represents where the middle of the particle effect is. 184

184

If I scroll down on my particle effect, and find let's see, Shape, and on Shape, 185

185

I've got position on my X coordinate, if I drag that over a little bit, 186

186

you can see that this is where the origin, or the basis of the particle 187

187

effect is gonna be, and this is where spawning the actual particle. 188

188

So, if I click play, that's a little bit to the left. 189

189

I know this is a little bit hacky, but I think this is a great quick solution to 190

190

the fact that it's not quite lining up the way we want it to line up. 191

191

Instead of having to go and mess around with the lizard, 192

192

and the lizards animation we can do that later on. 193

193

We'll tidy that later on, but this is just a quickie. 194

194

We'll apply this back to the prefab. 195

195

Just remove that from our scene. 196

196

Let's have our lizard come walking in, walk, walk, walk, walk, and boink, 197

197

that looked like it landed right over the top, so that's pretty good. 198

198

Okay, as I said, it's not the best particle effect. 199

199

Hopefully you've done something a little bit sharper than that, and also, 200

200

if you've found that it's not spawning quite in the right place, 201

201

I've given you a bit of a hint there on how you can tweak your particle effect. 202

202

Okay, so that's all I wanted to do in this video, just tidying thing up and 203

203

getting a little bit of a particle effect triggering. 204

204

In the next video, we'll do, I'm not sure yet, something cool [LAUGH]. 205

205

I'll see you in the next video.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.