00:00:00,030 --> 00:00:05,790
thanks for tuning in at brakus hello

00:00:04,350 --> 00:00:07,470
everyone and welcome to the first video

00:00:05,790 --> 00:00:09,809
on creating a tower defense game in

00:00:07,470 --> 00:00:12,150
unity I'm really really excited about

00:00:09,809 --> 00:00:14,130
this video both because tower defense

00:00:12,150 --> 00:00:15,660
games are awesome to make it's really

00:00:14,130 --> 00:00:18,480
fun and I have a lot of stuff that I

00:00:15,660 --> 00:00:20,340
want to show you but also because this

00:00:18,480 --> 00:00:22,500
is the very first video I'm doing since

00:00:20,340 --> 00:00:25,050
going full time with break YZ I'm taking

00:00:22,500 --> 00:00:26,849
my chances and investing all of my time

00:00:25,050 --> 00:00:29,550
into the channel that means that you

00:00:26,849 --> 00:00:32,189
will see more new content such as this

00:00:29,550 --> 00:00:33,750
and more content on this series we

00:00:32,189 --> 00:00:36,450
already have growing such as the

00:00:33,750 --> 00:00:38,190
multiplayer FPS and the 2d platformer

00:00:36,450 --> 00:00:40,620
course so that's really really exciting

00:00:38,190 --> 00:00:42,660
and to make all of this possible I've

00:00:40,620 --> 00:00:45,450
started a patreon page because let's

00:00:42,660 --> 00:00:48,840
face it I do have to pay rent where you

00:00:45,450 --> 00:00:50,850
can donate monthly ah to support me on

00:00:48,840 --> 00:00:54,390
my mission and that's really exciting

00:00:50,850 --> 00:00:56,489
the page itself looks like this you can

00:00:54,390 --> 00:00:59,430
click the screen now to be taking over

00:00:56,489 --> 00:01:02,460
here I offer some humble rewards in

00:00:59,430 --> 00:01:06,299
return and the first 25 or the first 5

00:01:02,460 --> 00:01:08,159
people to donate $25 or more will get

00:01:06,299 --> 00:01:11,430
whatever project they're working on

00:01:08,159 --> 00:01:14,130
featured on Twitter Facebook and on the

00:01:11,430 --> 00:01:16,860
forum so if you're excited about this

00:01:14,130 --> 00:01:18,630
just as I am you should go here and at

00:01:16,860 --> 00:01:21,810
least check it out if it's something for

00:01:18,630 --> 00:01:24,509
you I I really appreciate it you are no

00:01:21,810 --> 00:01:26,100
way forced to do this but it's awesome

00:01:24,509 --> 00:01:28,530
and thanks to the people who have

00:01:26,100 --> 00:01:30,869
already donated so without further ado

00:01:28,530 --> 00:01:32,520
let's get right into today's video so

00:01:30,869 --> 00:01:35,610
I've opened up unity and I'm using

00:01:32,520 --> 00:01:37,590
version 5,3 point 5 but you can pretty

00:01:35,610 --> 00:01:40,020
much use any version that you want to

00:01:37,590 --> 00:01:41,880
it's not going to matter too much for

00:01:40,020 --> 00:01:43,530
what we are going to be doing so to

00:01:41,880 --> 00:01:45,329
create a new project we are going to hit

00:01:43,530 --> 00:01:47,159
new then we are going to type in the

00:01:45,329 --> 00:01:50,040
name of our project that's in my case

00:01:47,159 --> 00:01:52,680
going to be tower defense tutorial you

00:01:50,040 --> 00:01:55,350
can select the location and choose 3d

00:01:52,680 --> 00:01:57,329
and the reason why is I recently sent

00:01:55,350 --> 00:01:58,860
out a poll on Facebook and Twitter

00:01:57,329 --> 00:02:02,130
asking whether or not the search should

00:01:58,860 --> 00:02:03,899
be in 3d or 2d along with the question

00:02:02,130 --> 00:02:06,990
of what programming language we should

00:02:03,899 --> 00:02:09,300
be using and the result of the poll is

00:02:06,990 --> 00:02:12,090
on the screen now and that was of course

00:02:09,300 --> 00:02:13,150
3d and c-sharp so that's what we're

00:02:12,090 --> 00:02:16,000
going to be doing

00:02:13,150 --> 00:02:18,340
and then hit create project which I've

00:02:16,000 --> 00:02:21,099
already done and opened it up in unity

00:02:18,340 --> 00:02:22,450
and then it should look like this so the

00:02:21,099 --> 00:02:24,489
first thing that I want to do here is

00:02:22,450 --> 00:02:27,640
populate our scene with some of the

00:02:24,489 --> 00:02:29,890
stuff that we are going to need in there

00:02:27,640 --> 00:02:31,390
and these some of these graphics might

00:02:29,890 --> 00:02:33,909
be temporary

00:02:31,390 --> 00:02:37,420
but it's great to get something in there

00:02:33,909 --> 00:02:39,430
that we can use and the basics of any

00:02:37,420 --> 00:02:41,799
tower defense game is some kind of start

00:02:39,430 --> 00:02:44,530
and end point for your enemies to walk

00:02:41,799 --> 00:02:47,769
from one to another and then a path that

00:02:44,530 --> 00:02:49,329
they take in getting there and also we

00:02:47,769 --> 00:02:52,599
need some place where we can place

00:02:49,329 --> 00:02:55,810
turrets in our case any turret is going

00:02:52,599 --> 00:02:58,209
to be placed on a platform that we call

00:02:55,810 --> 00:02:59,709
a node so let's go ahead and make a node

00:02:58,209 --> 00:03:02,980
right now so right-click in the

00:02:59,709 --> 00:03:05,519
hierarchy go to 3d object select cube

00:03:02,980 --> 00:03:11,139
then we're going to reset the transform

00:03:05,519 --> 00:03:15,159
do a scale of 4 by 1 5 4 and then hit F

00:03:11,139 --> 00:03:16,750
to assume a nod so you can see here that

00:03:15,159 --> 00:03:18,760
we are going to keep the box Collider

00:03:16,750 --> 00:03:21,819
and the mesh renderer that's all very

00:03:18,760 --> 00:03:25,000
fine and what we can then do is rename

00:03:21,819 --> 00:03:27,190
this one to node and drag it down to in

00:03:25,000 --> 00:03:30,099
the to the project to make it into a

00:03:27,190 --> 00:03:32,260
prefab then we can create an empty game

00:03:30,099 --> 00:03:35,260
object which we will also reach set the

00:03:32,260 --> 00:03:37,030
transform on and rename to notes and

00:03:35,260 --> 00:03:39,819
this is simply going to store all of our

00:03:37,030 --> 00:03:42,760
node and all of our node objects as

00:03:39,819 --> 00:03:45,220
children so that's perfect what we can

00:03:42,760 --> 00:03:48,699
do now is we can simply duplicate this

00:03:45,220 --> 00:03:50,470
node then we can move it over using ctrl

00:03:48,699 --> 00:03:53,440
and I'm going to leave a small space

00:03:50,470 --> 00:03:57,280
here and I just want a bunch of nodes

00:03:53,440 --> 00:03:59,590
here that will be a bunch of places that

00:03:57,280 --> 00:04:02,049
we can place turrets and also show the

00:03:59,590 --> 00:04:04,389
confines of our map so let's go ahead

00:04:02,049 --> 00:04:06,669
and make a grid of some of these nodes

00:04:04,389 --> 00:04:11,260
and of course if you make your map too

00:04:06,669 --> 00:04:14,349
big it's going to be very slow this

00:04:11,260 --> 00:04:17,260
method of doing it that optimizations

00:04:14,349 --> 00:04:20,289
that you can make but as long as you

00:04:17,260 --> 00:04:21,729
give your map a reasonable size it's

00:04:20,289 --> 00:04:24,159
really not going to be an issue

00:04:21,729 --> 00:04:26,260
especially because unity has gotten so

00:04:24,159 --> 00:04:29,890
good at handling a lot of

00:04:26,260 --> 00:04:32,170
objects of the same type so let's select

00:04:29,890 --> 00:04:34,060
these two by holding down shift hit

00:04:32,170 --> 00:04:36,490
control D to duplicate and holding down

00:04:34,060 --> 00:04:39,160
control again to move them over and keep

00:04:36,490 --> 00:04:42,400
doing this in shifting direction so that

00:04:39,160 --> 00:04:45,130
we end up with a complete square and we

00:04:42,400 --> 00:04:48,400
I will just keep doing this just a few

00:04:45,130 --> 00:04:54,240
more times to get a map of a reasonable

00:04:48,400 --> 00:04:58,180
size and we can do this just once more

00:04:54,240 --> 00:05:00,040
here in this direction and one time in

00:04:58,180 --> 00:05:02,080
the other direction of course this if

00:05:00,040 --> 00:05:04,750
this is going to be a mobile game you'll

00:05:02,080 --> 00:05:06,970
have to think more about performance but

00:05:04,750 --> 00:05:09,430
this here is going to be fine for any

00:05:06,970 --> 00:05:12,160
reasonable desktop it's going to be just

00:05:09,430 --> 00:05:13,690
fine so all of our notes are now in here

00:05:12,160 --> 00:05:16,300
and the good thing is that we made it

00:05:13,690 --> 00:05:19,000
into a prefab so if we change one all of

00:05:16,300 --> 00:05:21,400
them will change so what we can do now

00:05:19,000 --> 00:05:23,890
is simply collapse this nodes here and

00:05:21,400 --> 00:05:25,960
then we will save our scene just to be

00:05:23,890 --> 00:05:30,370
on the safe side and I'm going to call

00:05:25,960 --> 00:05:33,070
this the main scene and what we can do

00:05:30,370 --> 00:05:36,790
is now specify a path for enemies to

00:05:33,070 --> 00:05:38,320
walk along so I want our enemies to

00:05:36,790 --> 00:05:41,020
start up here so I'm going to select

00:05:38,320 --> 00:05:43,870
this node and delete it and end down

00:05:41,020 --> 00:05:46,210
here select that node and delete it and

00:05:43,870 --> 00:05:50,890
we will not do the same with any notes

00:05:46,210 --> 00:05:53,890
that these enemies should walk over and

00:05:50,890 --> 00:05:56,560
then delete them and then instead create

00:05:53,890 --> 00:05:58,840
some kind of ground object that they

00:05:56,560 --> 00:06:01,180
will move along so let's go ahead and

00:05:58,840 --> 00:06:03,760
make a path by simply selecting objects

00:06:01,180 --> 00:06:05,500
here I want them to and again I'm

00:06:03,760 --> 00:06:11,050
holding down shift to do this I warn

00:06:05,500 --> 00:06:13,510
them - oops that was a wrong one are the

00:06:11,050 --> 00:06:16,300
transform is getting in the way there so

00:06:13,510 --> 00:06:18,340
I want them to walk down there then over

00:06:16,300 --> 00:06:22,360
here and then up a bit then I want them

00:06:18,340 --> 00:06:25,390
to walk over and then take a path down

00:06:22,360 --> 00:06:30,040
again and this time I want them to go

00:06:25,390 --> 00:06:35,850
way down here over here and then around

00:06:30,040 --> 00:06:38,940
and we can make them go up a bit and

00:06:35,850 --> 00:06:42,180
over and I

00:06:38,940 --> 00:06:45,870
and over and then I want them to take

00:06:42,180 --> 00:06:49,350
the straight path down here to their

00:06:45,870 --> 00:06:51,540
final destination point so this is what

00:06:49,350 --> 00:06:53,970
my path is going to look like you can of

00:06:51,540 --> 00:06:58,290
course change yours to whatever you want

00:06:53,970 --> 00:07:00,000
and make different levels in this way so

00:06:58,290 --> 00:07:02,490
this is going to be the first level and

00:07:00,000 --> 00:07:05,040
what I'm going to do now is create some

00:07:02,490 --> 00:07:08,190
ground objects to fill out these empty

00:07:05,040 --> 00:07:10,680
spaces so let's right-click go to 3d

00:07:08,190 --> 00:07:14,310
objects select cube again reset the

00:07:10,680 --> 00:07:16,890
transform on this and name this a ground

00:07:14,310 --> 00:07:19,080
object then we can go ahead and maybe

00:07:16,890 --> 00:07:24,150
move this over again holding down ctrl

00:07:19,080 --> 00:07:27,300
make this a 4x4 by default you can watch

00:07:24,150 --> 00:07:29,400
it here zoom in on it by hitting F let's

00:07:27,300 --> 00:07:32,400
then create a new material for this so

00:07:29,400 --> 00:07:34,800
create material and call this one ground

00:07:32,400 --> 00:07:36,840
and we are going to drag it on there and

00:07:34,800 --> 00:07:40,080
then let's change the albedo to

00:07:36,840 --> 00:07:41,970
something a bit more dark grayish that

00:07:40,080 --> 00:07:44,430
we can bump up the metallic Ness just a

00:07:41,970 --> 00:07:47,040
bit and turn the smoothness all the way

00:07:44,430 --> 00:07:50,400
down to make it a very matte material so

00:07:47,040 --> 00:07:52,169
that looks kind of great and it's very

00:07:50,400 --> 00:07:54,600
clear that this node is different from

00:07:52,169 --> 00:07:56,669
the others so that's perfect and what we

00:07:54,600 --> 00:07:59,520
can then do is you can of course go with

00:07:56,669 --> 00:08:01,590
the same node design here but instead I

00:07:59,520 --> 00:08:04,230
simply want to scale up this node to

00:08:01,590 --> 00:08:05,760
fill out the entire path so in order to

00:08:04,230 --> 00:08:08,520
do this that's maybe move it over

00:08:05,760 --> 00:08:11,160
towards the center here of this small

00:08:08,520 --> 00:08:14,190
area of the path then we can instead of

00:08:11,160 --> 00:08:16,830
just scaling like this we can go in and

00:08:14,190 --> 00:08:20,940
choose edit snap settings and here we

00:08:16,830 --> 00:08:23,100
can adjust how our objects snap to the

00:08:20,940 --> 00:08:25,980
grid and in this case we want the scale

00:08:23,100 --> 00:08:29,280
to snap every one units so I'm going to

00:08:25,980 --> 00:08:31,860
scale it up here and it looks like

00:08:29,280 --> 00:08:34,229
everyone units actually wasn't perfect

00:08:31,860 --> 00:08:37,740
because now we're getting this offset

00:08:34,229 --> 00:08:40,440
which we don't want so let's choose 0,1

00:08:37,740 --> 00:08:43,890
again here and then we can find adjust

00:08:40,440 --> 00:08:46,770
this so let's do that's actually too

00:08:43,890 --> 00:08:48,780
much so we can do point zero one or you

00:08:46,770 --> 00:08:51,570
can simply type in the correct and

00:08:48,780 --> 00:08:52,680
upload up here which I'm going to do so

00:08:51,570 --> 00:08:57,270
let's try

00:08:52,680 --> 00:09:01,740
twenty-nine here oops 29 and then move

00:08:57,270 --> 00:09:03,480
this over with a tool and it's still

00:09:01,740 --> 00:09:05,520
offset because our movement is now

00:09:03,480 --> 00:09:07,470
offset so what we can simply do is set

00:09:05,520 --> 00:09:09,440
the position here and you can see this

00:09:07,470 --> 00:09:12,990
right here is the exposition to

00:09:09,440 --> 00:09:15,390
seventeen point five and that's perfect

00:09:12,990 --> 00:09:16,710
so now it's snapped correctly and that

00:09:15,390 --> 00:09:19,530
looks fine then we can go ahead and

00:09:16,710 --> 00:09:22,320
duplicate this object rotate it by 90

00:09:19,530 --> 00:09:24,000
degrees move it down here again by

00:09:22,320 --> 00:09:26,820
holding down control and you can see

00:09:24,000 --> 00:09:29,400
again that this is snapped incorrectly

00:09:26,820 --> 00:09:33,840
so maybe we should set these to 0,5 on

00:09:29,400 --> 00:09:36,630
the X and Z so we can move it down there

00:09:33,840 --> 00:09:40,770
and then we can scale it in and I want

00:09:36,630 --> 00:09:43,260
to do this every 0,1 units and move it

00:09:40,770 --> 00:09:47,220
over and you can just keep doing this to

00:09:43,260 --> 00:09:48,930
fill out the entire level something like

00:09:47,220 --> 00:09:53,220
that and then we can again duplicate

00:09:48,930 --> 00:09:54,810
this and rotate it back and I'm just

00:09:53,220 --> 00:09:57,480
going to do this to fill out the entire

00:09:54,810 --> 00:09:59,720
path and when I'm done I'm going to be

00:09:57,480 --> 00:09:59,720
back

00:10:04,649 --> 00:10:09,160
okay so I'm done creating our map and

00:10:06,940 --> 00:10:12,040
this looks just fine you could of course

00:10:09,160 --> 00:10:13,690
spend more time on this than I do but

00:10:12,040 --> 00:10:15,940
for the sake of the tutorial let's

00:10:13,690 --> 00:10:17,920
continue and let's right-click in the

00:10:15,940 --> 00:10:20,140
hierarchy to create another empty object

00:10:17,920 --> 00:10:23,589
and I'm just going to reset this and

00:10:20,140 --> 00:10:25,690
call this one environment and then we

00:10:23,589 --> 00:10:28,149
can take all of our ground objects and

00:10:25,690 --> 00:10:30,640
drag them into the environment and close

00:10:28,149 --> 00:10:33,370
that off just like that then let's

00:10:30,640 --> 00:10:35,620
create a object that will act as our

00:10:33,370 --> 00:10:37,810
starting point and one that will act as

00:10:35,620 --> 00:10:40,959
our ending point and again you know the

00:10:37,810 --> 00:10:43,300
procedure 3d object cube reset it call

00:10:40,959 --> 00:10:49,209
this one start and I'm going to do

00:10:43,300 --> 00:10:50,740
capital letters on this one and yeah so

00:10:49,209 --> 00:10:54,940
that's fine and let's go ahead and add a

00:10:50,740 --> 00:10:58,089
material for this so actually this start

00:10:54,940 --> 00:11:00,339
node here needs to be four by four on

00:10:58,089 --> 00:11:03,610
the X and Z as well and then I'm

00:11:00,339 --> 00:11:06,399
thinking four on the Y so what we can do

00:11:03,610 --> 00:11:11,740
with this is that we can actually move

00:11:06,399 --> 00:11:15,940
it up by two point five and then we can

00:11:11,740 --> 00:11:17,860
drag it over to stand on our ground here

00:11:15,940 --> 00:11:20,440
and I'm just going to drag it over so

00:11:17,860 --> 00:11:22,180
it's x correctly something like that and

00:11:20,440 --> 00:11:25,690
this is going to be the starting point

00:11:22,180 --> 00:11:27,910
so I think this looks just fine and what

00:11:25,690 --> 00:11:29,560
we can do with this is that we can then

00:11:27,910 --> 00:11:32,200
change the material so let's create a

00:11:29,560 --> 00:11:35,230
new material and this is going to be

00:11:32,200 --> 00:11:36,070
this start and I'm just going to drag

00:11:35,230 --> 00:11:39,040
that on there

00:11:36,070 --> 00:11:42,220
and then change the albedo to something

00:11:39,040 --> 00:11:46,029
um let's see let's change this to

00:11:42,220 --> 00:11:48,850
something green so some kind of matte

00:11:46,029 --> 00:11:50,709
green I think that color there looks

00:11:48,850 --> 00:11:53,470
just fine let's again bump down the

00:11:50,709 --> 00:11:55,630
smoothness quite a bit and maybe just a

00:11:53,470 --> 00:11:58,209
bit of metallic no no metal Ignace on

00:11:55,630 --> 00:12:01,630
this one and I don't want this to be on

00:11:58,209 --> 00:12:04,240
too saturated so something like that

00:12:01,630 --> 00:12:06,430
looks pretty nice I think and then we

00:12:04,240 --> 00:12:10,750
can simply duplicate this node and then

00:12:06,430 --> 00:12:13,900
drag it over here and make this one our

00:12:10,750 --> 00:12:16,510
end node so there we go and this is

00:12:13,900 --> 00:12:17,230
going to be our end and we are going to

00:12:16,510 --> 00:12:18,940
create a

00:12:17,230 --> 00:12:20,890
material for this I'm just going to

00:12:18,940 --> 00:12:24,160
duplicate this start material and call

00:12:20,890 --> 00:12:27,160
this one end let's drag it on there as

00:12:24,160 --> 00:12:30,910
well and change the albedo to something

00:12:27,160 --> 00:12:33,250
more red and we want this to be a bit

00:12:30,910 --> 00:12:37,000
more saturated so it's very clear that

00:12:33,250 --> 00:12:38,920
this is a red color great so it's going

00:12:37,000 --> 00:12:43,450
to walk from this star that's maybe just

00:12:38,920 --> 00:12:46,210
a bit too much something like that looks

00:12:43,450 --> 00:12:48,130
nice on my screen at least so it's going

00:12:46,210 --> 00:12:53,290
to walk from start and all the way along

00:12:48,130 --> 00:12:55,630
this path over to our end node and we

00:12:53,290 --> 00:12:57,550
should be able to remove the box

00:12:55,630 --> 00:13:00,190
colliders on the start and end node

00:12:57,550 --> 00:13:03,220
along with the colliders on all of our

00:13:00,190 --> 00:13:05,290
ground objects so let's just remove the

00:13:03,220 --> 00:13:07,060
box Collider on those and if you are

00:13:05,290 --> 00:13:10,090
very smart you had made the ground

00:13:07,060 --> 00:13:12,490
object into a prefab I did not think

00:13:10,090 --> 00:13:14,950
about this you might as well do it if

00:13:12,490 --> 00:13:17,440
you haven't created them yet but for now

00:13:14,950 --> 00:13:20,530
unities multiple object selection works

00:13:17,440 --> 00:13:22,660
just fine so let's save this scene and

00:13:20,530 --> 00:13:25,330
this is pretty much going to include the

00:13:22,660 --> 00:13:27,130
very first video on this in the next one

00:13:25,330 --> 00:13:30,400
we are going to make this scene come to

00:13:27,130 --> 00:13:32,260
life a bit more so I hope you enjoyed

00:13:30,400 --> 00:13:35,170
this video I hope that you're looking as

00:13:32,260 --> 00:13:38,200
much forward to future videos in this

00:13:35,170 --> 00:13:40,690
series as I am and again thanks to all

00:13:38,200 --> 00:13:42,520
of the amazing patreon supporters so

00:13:40,690 --> 00:13:45,100
thanks for watching the video and I'll

00:13:42,520 --> 00:13:46,750
see you in the next one thanks to all of

00:13:45,100 --> 00:13:49,210
the awesome patreon supporters who have

00:13:46,750 --> 00:13:51,220
donated so far and a special thanks to

00:13:49,210 --> 00:13:53,790
Lux game TV with the real name Jeff

00:13:51,220 --> 00:13:53,790
sacred


