Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
1
00:00:00,000 --> 00:00:04,091
[MUSIC]
2
2
00:00:04,091 --> 00:00:08,182
Hey, hey in this video, we're gonna be
creating a simple defender that has some
3
3
00:00:08,182 --> 00:00:10,660
animation and
maybe changes color a little bit.
4
4
00:00:10,660 --> 00:00:12,226
And an animation event that says,
5
5
00:00:12,226 --> 00:00:15,416
this is the point where we want it to
shoot out some sort of projectile.
6
6
00:00:15,416 --> 00:00:19,484
So that in upcoming videos, we can have
our defenders actually do defending.
7
7
00:00:19,484 --> 00:00:22,859
So let's jump in and
set up a simple defender prefab.
8
8
00:00:22,859 --> 00:00:26,661
A quick tidy up,
I'm gonna creat a empty game object.
9
9
00:00:26,661 --> 00:00:31,845
An empty game object to use better
grammar and I'll call this Sporners.
10
10
00:00:31,845 --> 00:00:37,098
Reset the transform of that and then just
place my five Sporners underneath that.
11
11
00:00:37,098 --> 00:00:39,627
So just tidy it up a little bit,
there we go.
12
12
00:00:39,627 --> 00:00:41,374
Lovely and my trophy.
13
13
00:00:41,374 --> 00:00:43,161
Have we prefabbed the trophy?
14
14
00:00:43,161 --> 00:00:44,155
Yes, we have.
15
15
00:00:44,155 --> 00:00:47,233
So I just removed the trophy
from the scene for now.
16
16
00:00:47,233 --> 00:00:49,544
Well, actually, nope,
I'm going to leave it there.
17
17
00:00:49,544 --> 00:00:52,239
So we keep it tidy and we don't
have things getting in the way, but
18
18
00:00:52,239 --> 00:00:55,533
it's sometimes good to have a visual
representation in a point of comparison.
19
19
00:00:55,533 --> 00:00:57,274
So let's leave it in there, okay?
20
20
00:00:57,274 --> 00:01:00,550
So what we need to do is start
off with a big old challenge,
21
21
00:01:00,550 --> 00:01:03,712
cuz I think you're ready to
take on all these aspects.
22
22
00:01:03,712 --> 00:01:08,093
That's creating a defender,
the animations and animated controller.
23
23
00:01:08,093 --> 00:01:11,352
So slice up the sprite sheet,
what I'm gonna do is choose.
24
24
00:01:11,352 --> 00:01:14,866
Let me see, so
we do this together from my not in use.
25
25
00:01:14,866 --> 00:01:16,436
I'm gonna create cactus.
26
26
00:01:16,436 --> 00:01:21,022
So let me just create a new folder here.
27
27
00:01:21,022 --> 00:01:23,290
Cache, cache does.
28
28
00:01:23,290 --> 00:01:27,745
Okay and then from my not in use,
I'm gonna grab cactus distitle and
29
29
00:01:27,745 --> 00:01:31,044
cactus dislooping and
drag this in to cache this.
30
30
00:01:31,044 --> 00:01:34,978
Okay, so slice u your sprite sheet,
the one that I was selecting they are not
31
31
00:01:34,978 --> 00:01:38,975
the ones and create an idle animation
from the idle animation sprite sheet and
32
32
00:01:38,975 --> 00:01:42,574
create an attack animation from
the attack animation sprite sheet.
33
33
00:01:42,574 --> 00:01:47,525
And then to add an animation event when
you feel that the defender should shoot
34
34
00:01:47,525 --> 00:01:51,942
a projectile at that to the attack
animation, an animation event and
35
35
00:01:51,942 --> 00:01:56,893
then to create an animated controller
where we start off in idle animation and
36
36
00:01:56,893 --> 00:01:59,203
then just go straight into attack.
37
37
00:01:59,203 --> 00:02:02,958
So at the moment we won't have any sort of
trigger to say to go from idle to attack,
38
38
00:02:02,958 --> 00:02:05,736
but we'll have our shape set up,
so we're ready for that.
39
39
00:02:05,736 --> 00:02:07,564
So it's a pretty meaty challenge, jump in.
40
40
00:02:07,564 --> 00:02:10,399
Take that on, I'll see you back
here when you've got that done or
41
41
00:02:10,399 --> 00:02:11,698
you can do it at the same time.
42
42
00:02:11,698 --> 00:02:15,688
I'm doing it just now,
if you'd like to do that.
43
43
00:02:15,688 --> 00:02:16,494
Okay, let's see.
44
44
00:02:16,494 --> 00:02:19,910
So we've got our idle and
I'm going to slice it up.
45
45
00:02:19,910 --> 00:02:25,317
Change my sprite mode to multiple,
click on Apply.
46
46
00:02:25,317 --> 00:02:27,165
Now let's have a look at this.
47
47
00:02:27,165 --> 00:02:31,647
Cactus Idle and
take note it's 924 by 1008.
48
48
00:02:31,647 --> 00:02:36,745
Get out my calculator, Calculator,
cuz I'm gonna slice by grid.
49
49
00:02:36,745 --> 00:02:38,064
This will be not, how many have we got?
50
50
00:02:38,064 --> 00:02:39,954
One, two, three, four, five, six.
51
51
00:02:39,954 --> 00:02:44,848
So 942 divided by 6 equals 157.
52
52
00:02:44,848 --> 00:02:49,738
I'm gonna write that down
on my bit of paper here and
53
53
00:02:49,738 --> 00:02:54,624
then 108 divided by 1, 2, 3, 4, 5, 6,
54
54
00:02:54,624 --> 00:02:58,861
7, 8, 1008 divided by 8 is 126.
55
55
00:02:58,861 --> 00:03:03,630
Now, we go into sprite editor.
56
56
00:03:03,630 --> 00:03:08,712
Go up to slice,
change this to grid by cell size and
57
57
00:03:08,712 --> 00:03:12,836
we'll change this to 157 by 126.
58
58
00:03:12,836 --> 00:03:15,665
I've done this before, so
it should be pretty familiar.
59
59
00:03:15,665 --> 00:03:18,459
That's all looking pretty good with
just a little bit of a cycle through.
60
60
00:03:18,459 --> 00:03:19,904
Yeah, that looks good.
61
61
00:03:19,904 --> 00:03:21,519
Okay, it's all looking pretty good.
62
62
00:03:21,519 --> 00:03:23,713
Nothing's been chopped off
at all looks in a good spot.
63
63
00:03:23,713 --> 00:03:25,537
Okay, then click on Apply.
64
64
00:03:25,537 --> 00:03:28,492
Nice, close that out for now.
65
65
00:03:28,492 --> 00:03:31,352
We have our sprite sheet sliced up.
66
66
00:03:31,352 --> 00:03:33,853
I'll go and slice up the other one for
now while I'm here.
67
67
00:03:33,853 --> 00:03:37,500
The cactus looping,
otherwise known as the Cactus Attack.
68
68
00:03:37,500 --> 00:03:38,943
Sounds like a bad movie, doesn't it?
69
69
00:03:38,943 --> 00:03:41,548
Multiple, [LAUGH] click Apply.
70
70
00:03:41,548 --> 00:03:43,071
Click on the sprite editor.
71
71
00:03:43,071 --> 00:03:44,752
This is different again, okay.
72
72
00:03:44,752 --> 00:03:47,410
Let me find the cactus looping,
the dimensions here.
73
73
00:03:47,410 --> 00:03:50,958
So left to right, we've got one,
two, three, four, five, six.
74
74
00:03:50,958 --> 00:03:53,560
This has got a lot of images on it,
hasn't it?
75
75
00:03:53,560 --> 00:03:58,137
So this is 942 that I'm getting from
76
76
00:03:58,137 --> 00:04:03,385
down here in the dimensions divided by 6.
77
77
00:04:03,385 --> 00:04:04,639
That's 157 again.
78
78
00:04:04,639 --> 00:04:09,455
Okay, that makes it easy and
then it is 1638.
79
79
00:04:09,455 --> 00:04:10,968
I think this is gonna be exactly the same.
80
80
00:04:10,968 --> 00:04:14,687
1638 divided by 1, 2, 3, 4, 5,
81
81
00:04:14,687 --> 00:04:19,517
6, 7, 8, 9, 10, 11, 12, 13, 126.
82
82
00:04:19,517 --> 00:04:20,696
Yes, it is exactly the same.
83
83
00:04:20,696 --> 00:04:21,585
Okay, great.
84
84
00:04:21,585 --> 00:04:23,746
157, 126, slice that up.
85
85
00:04:23,746 --> 00:04:25,022
It all looks pretty good.
86
86
00:04:25,022 --> 00:04:30,163
Click on Apply and job is done, fantastic.
87
87
00:04:30,163 --> 00:04:33,603
Did you play the old Warcraft
games way back in the day?
88
88
00:04:33,603 --> 00:04:35,570
Warcraft II, job's done.
89
89
00:04:35,570 --> 00:04:38,630
That's how the peasant used to say
that they'd finished their job.
90
90
00:04:38,630 --> 00:04:41,096
That's what I thought of just now and
I'm saying job done.
91
91
00:04:41,096 --> 00:04:45,051
Okay, Cactus Idle,
highlight all of the Idle frames,
92
92
00:04:45,051 --> 00:04:47,669
right-click, create animation.
93
93
00:04:47,669 --> 00:04:48,851
There it is.
94
94
00:04:48,851 --> 00:04:54,179
Animation, we'll call this Cactus Idle.
95
95
00:04:54,179 --> 00:04:58,215
Drag my Cactus Idle animation
to my animation folder.
96
96
00:04:58,215 --> 00:05:02,164
Now we will create our next animation
which will be cactus looping,
97
97
00:05:02,164 --> 00:05:04,046
highlight all of these frames.
98
98
00:05:04,046 --> 00:05:09,893
There's ton of them, 63 and
then create animation and
99
99
00:05:09,893 --> 00:05:14,371
we'll call this Cactus Attack,
Cactus Attack.
100
100
00:05:14,371 --> 00:05:18,147
There we go, drop that into
the animation folder as well.
101
101
00:05:18,147 --> 00:05:19,430
Soon, we'll need to organize this.
102
102
00:05:19,430 --> 00:05:20,389
Actually, it's getting pretty close.
103
103
00:05:20,389 --> 00:05:25,076
I'm gonna organize this into attackers and
defenders, so create a new folder.
104
104
00:05:25,076 --> 00:05:32,045
Attackers and
then another folder, defenders.
105
105
00:05:32,045 --> 00:05:36,947
And then the cactus
goes into attackers and
106
106
00:05:36,947 --> 00:05:41,450
the lizard goes into, sorry attacks.
107
107
00:05:41,450 --> 00:05:42,695
God, I've got everything wrong here.
108
108
00:05:42,695 --> 00:05:43,824
It's attackers.
109
109
00:05:43,824 --> 00:05:48,416
Rick, you dingbat and then we need to,
did I just put them in there?
110
110
00:05:48,416 --> 00:05:51,766
Okay, so the cactus is a defender.
111
111
00:05:51,766 --> 00:05:54,240
Thank you for
those of you yelling at the screen.
112
112
00:05:54,240 --> 00:05:55,349
Rick, what are you doing?
113
113
00:05:55,349 --> 00:05:59,682
And then we have the trophy,
which technically is a defender.
114
114
00:05:59,682 --> 00:06:00,851
It's one of the goodies.
115
115
00:06:00,851 --> 00:06:02,146
Okay, here we go.
116
116
00:06:02,146 --> 00:06:05,278
Now that we've done that,
let's while we're here,
117
117
00:06:05,278 --> 00:06:08,421
let's just quickly create
our animated controller.
118
118
00:06:08,421 --> 00:06:13,021
So right-click,
Create > Animator Controller that
119
119
00:06:13,021 --> 00:06:17,921
we'll call cactus and
then click on the animator window.
120
120
00:06:17,921 --> 00:06:20,224
This should be the animator controller for
the cactus.
121
121
00:06:20,224 --> 00:06:21,702
Yes, it looks like it indeed.
122
122
00:06:21,702 --> 00:06:23,966
Excellent, what do we need to do next?
123
123
00:06:23,966 --> 00:06:25,923
Well, we need to create a game object.
124
124
00:06:25,923 --> 00:06:28,644
I didn't have that on my list, hopefully
you figured that out and found it.
125
125
00:06:28,644 --> 00:06:33,280
So right-click,
create empty this will be called cactus.
126
126
00:06:33,280 --> 00:06:36,440
Reset the transform back down to zero,
zero.
127
127
00:06:36,440 --> 00:06:39,278
We need to give this a sprite render, so
128
128
00:06:39,278 --> 00:06:43,494
we can see what it looks like and
see where it is in the game.
129
129
00:06:43,494 --> 00:06:47,042
Now pick one of our frames, so
go to cactus for the sprites.
130
130
00:06:47,042 --> 00:06:50,838
Which one do we wanna have represent
just how the cactus looks normally?
131
131
00:06:50,838 --> 00:06:53,890
Cactus one just fine and dandy, and
132
132
00:06:53,890 --> 00:06:58,588
we will drag Cactus Looping_1over
onto our sprite.
133
133
00:06:58,588 --> 00:06:59,390
There we go.
134
134
00:06:59,390 --> 00:07:03,104
Now change the border to five,
that's all the same.
135
135
00:07:03,104 --> 00:07:04,550
Great, that looks pretty good.
136
136
00:07:04,550 --> 00:07:09,410
Moving on to the thing might be a tiny bit
too big, but I'll leave it big for now.
137
137
00:07:09,410 --> 00:07:12,888
You can have a little bit of overlap,
perhaps and see how that goes.
138
138
00:07:12,888 --> 00:07:16,815
You can change that pretty easily later on
just by changing out pixels per unit in
139
139
00:07:16,815 --> 00:07:17,761
our spreadsheet.
140
140
00:07:17,761 --> 00:07:18,583
So here we go.
141
141
00:07:18,583 --> 00:07:20,104
We've got a cactus on the screen.
142
142
00:07:20,104 --> 00:07:22,188
We've got some animations.
143
143
00:07:22,188 --> 00:07:26,912
Let's go back to our animated
controller in defenders.
144
144
00:07:26,912 --> 00:07:28,612
Okay, got cactus here.
145
145
00:07:28,612 --> 00:07:33,171
Cactus dragging, our cactus first of all,
dragging the idle, Cactus Idle.
146
146
00:07:33,171 --> 00:07:37,158
Blink, that creates that as it's
first step and then Cactus Attack.
147
147
00:07:37,158 --> 00:07:41,053
We'll do the same as we did before where
we say, right-click from Cactus Idle,
148
148
00:07:41,053 --> 00:07:42,904
make transition into Cactus Attack.
149
149
00:07:42,904 --> 00:07:46,080
At the moment there's no condition for
when it should go into there,
150
150
00:07:46,080 --> 00:07:49,499
it'll just go straight in there after
it finishes doing its Cactus Idle.
151
151
00:07:49,499 --> 00:07:52,907
Have a look at the transition and
just clean that up a little bit.
152
152
00:07:52,907 --> 00:07:57,142
I like to have a 0 transition for
these 2D assets.
153
153
00:07:57,142 --> 00:08:01,139
Get that out of the way, that's pretty
good and then the exit time of one.
154
154
00:08:01,139 --> 00:08:02,439
Great, great stuff.
155
155
00:08:02,439 --> 00:08:07,408
Okay, Cactus Idle, let's make sure
it is not looping in our animation.
156
156
00:08:07,408 --> 00:08:09,344
Yep, that's correct and
then cactus attack.
157
157
00:08:09,344 --> 00:08:13,661
We'll leave that looping,
I think and loop that.
158
158
00:08:13,661 --> 00:08:15,632
Okay, that should be all pretty good.
159
159
00:08:15,632 --> 00:08:23,947
Last bit here is we need to say that
we need an animator on our cactus.
160
160
00:08:23,947 --> 00:08:26,835
Animator and
then what's our animator controller?
161
161
00:08:26,835 --> 00:08:30,121
Click on selector, it will be the cactus.
162
162
00:08:30,121 --> 00:08:35,481
Now all going to plan, that should animate
our cactus that goes from idle And
163
163
00:08:35,481 --> 00:08:38,599
the idle and
the attack are pretty similar.
164
164
00:08:38,599 --> 00:08:40,239
Well, that's very slow.
165
165
00:08:40,239 --> 00:08:44,874
And then [SOUND] okay, so again,
I wanna speed that up a whole bunch.
166
166
00:08:44,874 --> 00:08:46,207
Let's go and have a look at that.
167
167
00:08:46,207 --> 00:08:51,723
Cactus Idle for the moment for
animation is 12 frames per second and
168
168
00:08:51,723 --> 00:08:54,778
we've got tons, and tons of frames.
169
169
00:08:54,778 --> 00:08:57,819
Okay, so let us change that to,
170
170
00:08:57,819 --> 00:09:03,461
make it 24 like our other ones and
then the cactus attack.
171
171
00:09:03,461 --> 00:09:06,963
We'll make that 24 as well
just have a look at that.
172
172
00:09:06,963 --> 00:09:09,732
Make sure it's all looking nice and
neat, and tidy.
173
173
00:09:09,732 --> 00:09:11,631
So bounce, bounce, a little bit of bounce.
174
174
00:09:11,631 --> 00:09:13,167
And then now I'm gonna shoot.
175
175
00:09:13,167 --> 00:09:15,759
Okay, that's looking pretty good and
then it loops around.
176
176
00:09:15,759 --> 00:09:20,297
What I'll do in here just add one
little bit of flair into our attack,
177
177
00:09:20,297 --> 00:09:25,630
if I can get this happening is if I click
on the cactus attack animation which I am.
178
178
00:09:25,630 --> 00:09:27,471
I'm gonna click on Record.
179
179
00:09:27,471 --> 00:09:31,164
It's not letting me do that,
because I need to click on my cactus, and
180
180
00:09:31,164 --> 00:09:32,677
now it should let me record.
181
181
00:09:32,677 --> 00:09:34,599
Yes, click on Record.
182
182
00:09:34,599 --> 00:09:37,620
Move it to where I think it should shoot.
183
183
00:09:37,620 --> 00:09:41,000
Sorry, I'm on idle at the moment just
change the selection here to attack.
184
184
00:09:41,000 --> 00:09:44,958
Now, click on Record and
move it up to, maybe it's gonna go.
185
185
00:09:44,958 --> 00:09:49,685
[SOUND] Okay, [SOUND] so
the animation's not really made for
186
186
00:09:49,685 --> 00:09:55,389
shooting bullets, but maybe just as
it opens its mouth wide up there.
187
187
00:09:55,389 --> 00:09:58,003
So what I'll do is I'll add
an animation even in a moment.
188
188
00:09:58,003 --> 00:10:00,202
Actually, I'll do that right now
just click my animation event.
189
189
00:10:00,202 --> 00:10:01,391
We'll come back to that in a moment.
190
190
00:10:01,391 --> 00:10:05,860
What I'm gonna do in here is just change
the color of my sprite renderer on
191
191
00:10:05,860 --> 00:10:06,681
the cactus.
192
192
00:10:06,681 --> 00:10:11,670
So we will have it build up
to some sort of bright color.
193
193
00:10:11,670 --> 00:10:15,172
Watch we have it build up to a red.
194
194
00:10:15,172 --> 00:10:18,536
It's gonna be a little bit ugly,
my friends, but that's okay.
195
195
00:10:18,536 --> 00:10:23,098
Maybe build up to a bright green and then
I'm going to move back a little bit here.
196
196
00:10:23,098 --> 00:10:27,655
So we've got a key frame and then move
back to here a little bit on my selection,
197
197
00:10:27,655 --> 00:10:29,670
and put that back to normal white.
198
198
00:10:29,670 --> 00:10:32,530
So then, turn off my record mode.
199
199
00:10:32,530 --> 00:10:35,483
It should go normal, normal, normal and
then bright green and then blunk.
200
200
00:10:35,483 --> 00:10:37,016
Okay, it stayed on bright green.
201
201
00:10:37,016 --> 00:10:38,697
So I wanna have it after it shoots.
202
202
00:10:38,697 --> 00:10:44,516
I wanna have it go back to being white
again or no tinting as the case might be.
203
203
00:10:44,516 --> 00:10:47,051
Okay, so I'll click on Play,
see how this looks.
204
204
00:10:47,051 --> 00:10:52,095
[SOUND] And then building up and
then down, building up and down.
205
205
00:10:52,095 --> 00:10:55,206
So you could put a little bit of a flash
at the end there just as it shoots.
206
206
00:10:55,206 --> 00:10:56,978
It could be yellow, for example.
207
207
00:10:56,978 --> 00:11:00,080
But this is gonna give the player
a little bit of visual flair.
208
208
00:11:00,080 --> 00:11:01,485
So there's a lot more you can do for
color.
209
209
00:11:01,485 --> 00:11:04,513
I think this is pretty interesting
white add some depth to this bright.
210
210
00:11:04,513 --> 00:11:09,042
So we've got, now we have our animation
event and I believe that's looking
211
211
00:11:09,042 --> 00:11:14,093
a littler bit different as were expecting
as we don't have any script on our cactus.
212
212
00:11:14,093 --> 00:11:19,708
And a defender script as we have with our
lizard, we've got another script on there.
213
213
00:11:19,708 --> 00:11:22,424
So it's looking a little bit different,
our animation event.
214
214
00:11:22,424 --> 00:11:23,629
So we'll leave it for now.
215
215
00:11:23,629 --> 00:11:25,356
We've got everything setup
that we wanted to setup.
216
216
00:11:25,356 --> 00:11:27,661
This was just a quick little video to say,
let's get our.
217
217
00:11:27,661 --> 00:11:29,175
Defender ready and raring.
218
218
00:11:29,175 --> 00:11:30,915
We've out or event in there.
219
219
00:11:30,915 --> 00:11:33,613
That's the point where we want
to say this is where you shoot.
220
220
00:11:33,613 --> 00:11:34,922
Okay, that's looking pretty good.
221
221
00:11:34,922 --> 00:11:35,808
We've got our defender.
222
222
00:11:35,808 --> 00:11:40,890
Last step of prefabbing that, so
drag our cactus down into your prefabs.
223
223
00:11:40,890 --> 00:11:44,211
We'll do a little bit more
work on the cactus, so
224
224
00:11:44,211 --> 00:11:46,973
I'll leave it up here in our hierarchy.
225
225
00:11:46,973 --> 00:11:51,125
Good stuff, so we're ready to create some
functionality where the cactus will shoot
226
226
00:11:51,125 --> 00:11:53,619
and be damaged and
have health all of those things.
227
227
00:11:53,619 --> 00:11:55,030
So great work and
I'll see you in the next video.
22008
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.