1 00:00:28.040 --> 00:00:29.874 Hello, this is Yeong-hoon Lee 2 00:00:30.339 --> 00:00:35.459 Today we will work on a shooter game using Blueprints 3 00:00:35.459 --> 00:00:37.540 First, we will learn about Unreal Blueprint 4 00:00:37.540 --> 00:00:42.740 And then we will be creating a simple shooter game with it 5 00:00:42.740 --> 00:00:47.560 In this chapter, we will learn about a node-based interface of Blueprint 6 00:00:47.560 --> 00:00:50.467 A visual scripting system at Unreal Engine 7 00:00:51.299 --> 00:00:55.134 And in order to run attribute and method of a Blueprint Class 8 00:00:55.500 --> 00:00:58.136 We will be dealing with its basic grammar as well 9 00:00:58.713 --> 00:01:02.436 Coding and Visual Scripting 10 00:01:03.671 --> 00:01:07.680 Let's first learn about Blueprints 11 00:01:07.680 --> 00:01:09.718 Blueprint literally means a blueprint-outline 12 00:01:10.461 --> 00:01:15.665 So what is its role at Unreal Engine? 13 00:01:16.130 --> 00:01:19.202 On the screen, this is a Level 14 00:01:19.330 --> 00:01:21.644 And those that are on a Level are Actors 15 00:01:22.089 --> 00:01:24.600 These are also Actors here 16 00:01:25.590 --> 00:01:29.388 We could create our own Actors to place them 17 00:01:30.180 --> 00:01:33.372 As of now, all the content in the right, at Outliner is 18 00:01:34.699 --> 00:01:36.428 Coming from the content at Place Actors 19 00:01:37.220 --> 00:01:40.333 So they are coming from here to be placed there 20 00:01:41.649 --> 00:01:43.382 Let's now create a new one 21 00:01:43.610 --> 00:01:48.299 Here, at Content Browser, use Ctrl Space 22 00:01:48.299 --> 00:01:52.360 To slide up this Content Drawer 23 00:01:52.360 --> 00:01:56.293 We see the menu here, so right click on this and we see 24 00:01:56.670 --> 00:01:58.684 A Blueprint Class 25 00:02:00.109 --> 00:02:01.449 Let's create this 26 00:02:01.449 --> 00:02:04.970 Now we get all the options such as Actor, Pawn, Character and more 27 00:02:04.970 --> 00:02:06.945 Let's choose Actor here 28 00:02:10.113 --> 00:02:14.020 I will add a prefix 'BP_' standing for Blueprint 29 00:02:14.020 --> 00:02:17.281 And the name, 'TestActor' 30 00:02:19.380 --> 00:02:20.899 Shall we save here? 31 00:02:20.899 --> 00:02:23.619 You can click on this button, 'Save All' 32 00:02:23.619 --> 00:02:26.470 Or you could simply Ctrl S 33 00:02:26.470 --> 00:02:29.256 See how there are options for saving at File 34 00:02:29.820 --> 00:02:32.728 It will be convenient to use these hotkeys 35 00:02:33.441 --> 00:02:36.872 Now, let's bring out this 'BP_TestActor' 36 00:02:38.070 --> 00:02:42.581 Now, this Actor that we created 37 00:02:42.581 --> 00:02:46.465 We can place it at our Level, or on our screen 38 00:02:46.940 --> 00:02:51.250 So here at Ourliner, we see 'BP_TestActor' 39 00:02:51.250 --> 00:02:55.109 And notice how we have a new button called 'Edit' 40 00:02:56.436 --> 00:02:59.143 Click on this, or simply double click on this 41 00:03:00.816 --> 00:03:03.437 And we get the Editor Window 42 00:03:06.239 --> 00:03:10.531 So here, Blueprint is simply 43 00:03:10.601 --> 00:03:15.133 A necessary tool in order to create things such as this Actor 44 00:03:15.737 --> 00:03:20.214 To clarify, this is a Blueprint Class 45 00:03:20.758 --> 00:03:24.092 See how this is saying 'Blueprint Class' 46 00:03:24.300 --> 00:03:25.843 So it's a Blueprint Class 47 00:03:26.259 --> 00:03:30.315 And this to the right, at Outliner is called an Instance 48 00:03:32.077 --> 00:03:34.059 So this has been moved out here 49 00:03:34.059 --> 00:03:36.818 Let's double click and go to our Editor Window 50 00:03:38.748 --> 00:03:41.554 What we can do with a Blueprint is 51 00:03:41.900 --> 00:03:46.643 Because this is a Class, we have Class Defaults 52 00:03:46.890 --> 00:03:48.784 And Class Settings 53 00:03:49.259 --> 00:03:52.163 And we have Components to the left 54 00:03:52.500 --> 00:03:57.849 At 'My Blueprint' we see things like EventGraph under Graphs 55 00:03:57.849 --> 00:04:00.914 We also see Functions and Variables 56 00:04:02.300 --> 00:04:04.526 So this is how a Class is visualized 57 00:04:05.011 --> 00:04:06.977 Let's say we're drawing a circle 58 00:04:07.571 --> 00:04:12.120 This will contain its attributes and methods 59 00:04:12.377 --> 00:04:13.745 And this is called a class 60 00:04:17.349 --> 00:04:19.019 This class is a type 61 00:04:19.019 --> 00:04:28.636 In other words, a user-defined data type 62 00:04:30.457 --> 00:04:34.028 So in a class are its properties 63 00:04:35.899 --> 00:04:38.956 And these are its methods 64 00:04:39.560 --> 00:04:42.219 Attributes are what we usually call as variables 65 00:04:43.140 --> 00:04:45.050 They are created through variables 66 00:04:45.050 --> 00:04:49.660 And a method, through functions 67 00:04:49.660 --> 00:04:52.567 We will learn more about these later 68 00:04:53.497 --> 00:04:56.259 For example, let's say this is a class called human 69 00:04:57.230 --> 00:04:58.129 This is a human 70 00:05:00.090 --> 00:05:02.485 What attributes does a human have? 71 00:05:03.188 --> 00:05:04.623 We could say, the age 72 00:05:04.940 --> 00:05:07.660 The name, and things like this 73 00:05:08.967 --> 00:05:11.250 And its method, to walk 74 00:05:13.210 --> 00:05:19.084 To sit, and so many more possible methods 75 00:05:19.678 --> 00:05:22.663 So this thing that we created, a human class 76 00:05:22.969 --> 00:05:29.289 What would be its name? Let's say Lee Young Hoon 77 00:05:30.200 --> 00:05:33.149 This is the actual being that has been created 78 00:05:33.149 --> 00:05:37.270 And these beings are called objects 79 00:05:37.270 --> 00:05:38.711 So this is an object 80 00:05:39.899 --> 00:05:41.459 We call it an object and 81 00:05:44.321 --> 00:05:50.691 We could also call it an instance 82 00:05:51.810 --> 00:05:53.751 Object is more catering to its certain role 83 00:05:53.751 --> 00:05:57.299 And when we are creating variables in a memory space 84 00:05:57.299 --> 00:06:00.084 This class-making is a variable-making in other words 85 00:06:00.431 --> 00:06:02.438 And then with this, an instance is 86 00:06:03.250 --> 00:06:06.596 This being that physically exists in the memory space 87 00:06:07.893 --> 00:06:10.579 So, as we just looked at, a class is composed with 88 00:06:10.579 --> 00:06:13.725 It's attribute and method, or variable and function 89 00:06:15.488 --> 00:06:17.395 And in the end, see here 90 00:06:17.930 --> 00:06:20.412 See how there is the function part at Functions 91 00:06:20.689 --> 00:06:23.572 And then the variable part at Variables 92 00:06:25.077 --> 00:06:27.468 And we could code them 93 00:06:28.260 --> 00:06:31.370 The coding space is here, at Event Graph 94 00:06:33.628 --> 00:06:36.019 So this is how Event Graph looks like 95 00:06:36.019 --> 00:06:38.739 And here, right click on this space 96 00:06:38.739 --> 00:06:43.223 Right click and drag, and you can move this around 97 00:06:43.500 --> 00:06:46.441 And using the mouse wheel, you can resize the space 98 00:06:47.619 --> 00:06:50.010 So this is at 100%, and to make it bigger 99 00:06:50.010 --> 00:06:53.940 Press Control and use the mouse wheel 100 00:06:53.940 --> 00:06:55.640 Now you can see it bigger 101 00:06:56.987 --> 00:06:59.544 This is the basic control 102 00:07:01.148 --> 00:07:03.281 Whenever we learn a new language 103 00:07:03.281 --> 00:07:05.704 The first task is to print 'Hello World' 104 00:07:06.358 --> 00:07:08.807 So let's try and print 'Hello World' here 105 00:07:09.747 --> 00:07:12.138 Right click here 106 00:07:13.009 --> 00:07:14.260 And we see a menu like this 107 00:07:14.260 --> 00:07:19.278 Look for 'Print String' 108 00:07:20.249 --> 00:07:20.844 Click on this 109 00:07:22.359 --> 00:07:24.247 And let's connect them 110 00:07:25.990 --> 00:07:28.312 And we see how it has these things 111 00:07:29.837 --> 00:07:32.299 And now click on 'Compile' 112 00:07:32.299 --> 00:07:33.694 And save here 113 00:07:34.249 --> 00:07:36.596 We usually compile and then save 114 00:07:37.220 --> 00:07:40.339 And that's a lot of work, clicking two buttons in a row 115 00:07:40.339 --> 00:07:43.420 So go to this menu 116 00:07:43.420 --> 00:07:48.299 And for 'Save on Compile', try 'Always' 117 00:07:48.299 --> 00:07:51.340 And this will automatically save the work 118 00:07:52.598 --> 00:07:55.459 I will go with 'Always' 119 00:07:55.459 --> 00:07:58.839 This means whenever I click on 'Compile' it also saves 120 00:08:00.037 --> 00:08:03.459 And let's move back to this 'Untitled' area 121 00:08:03.459 --> 00:08:04.540 And let's run this 122 00:08:04.540 --> 00:08:06.280 This button here lets you run it 123 00:08:06.280 --> 00:08:10.064 Click on this, and we get a new window 124 00:08:10.441 --> 00:08:12.161 Do you also get this window? 125 00:08:12.161 --> 00:08:14.463 This is like a pop up window 126 00:08:14.820 --> 00:08:16.880 It's called a PIE Mode (Play In Editor Mode0 127 00:08:16.880 --> 00:08:20.151 Here on the right, we have a menu 128 00:08:20.151 --> 00:08:24.940 Here at 'New Editor Window' we see PIE Mode 129 00:08:24.940 --> 00:08:27.679 I will change it back to 'Select Viewpoint' 130 00:08:28.679 --> 00:08:31.704 So this will run this within the Viewport area 131 00:08:32.447 --> 00:08:33.539 Let's run it 132 00:08:33.539 --> 00:08:37.859 Now, to the right, we see 'Hello' 133 00:08:37.859 --> 00:08:38.954 And it quickly disappears 134 00:08:39.340 --> 00:08:42.882 It says 'Hello' because this here asks for 'Hello' 135 00:08:44.337 --> 00:08:48.790 So this is a gist of how you code for a Blueprint 136 00:08:48.790 --> 00:08:51.299 And this is called a node 137 00:08:51.299 --> 00:08:55.202 And a node looks like this, with some menu options 138 00:08:55.350 --> 00:08:59.480 These on the left are called pins 139 00:08:59.480 --> 00:09:02.283 This has no Output Pin, so let's look at something else 140 00:09:02.907 --> 00:09:09.533 Let's try a node called 'Set Actor Location' 141 00:09:11.345 --> 00:09:14.964 So this rectangular box is called a node 142 00:09:15.380 --> 00:09:17.641 And each node has some pins 143 00:09:17.849 --> 00:09:20.841 The first pin is an Execute Pin 144 00:09:20.841 --> 00:09:22.159 So this Execute Pin 145 00:09:22.980 --> 00:09:26.194 It moves from left to right, like this 146 00:09:29.293 --> 00:09:33.294 So the control flow is from left to right 147 00:09:33.660 --> 00:09:38.081 So after running this, it moves rightward 148 00:09:38.081 --> 00:09:40.731 And then it runs the next node 149 00:09:40.731 --> 00:09:42.706 That's the flow here 150 00:09:43.281 --> 00:09:45.877 And whenever we run this node 151 00:09:46.521 --> 00:09:49.120 This Input Node comes in as helpful 152 00:09:49.120 --> 00:09:52.064 So to the left is the Input Pin, and to the right is the Output Pin 153 00:09:52.470 --> 00:09:56.609 So for this node called Set Actor Location 154 00:09:57.450 --> 00:10:00.371 When this location node runs 155 00:10:00.371 --> 00:10:02.703 We need the value at this Input Pin on the left 156 00:10:04.347 --> 00:10:08.179 And we have some default values 157 00:10:08.179 --> 00:10:11.739 We could run it with its default values 158 00:10:11.739 --> 00:10:17.693 This node has something to do with the location, as its name states 159 00:10:17.961 --> 00:10:23.672 So this will specify the location of the Actor 160 00:10:23.920 --> 00:10:25.979 So once we add the value for the new location 161 00:10:25.979 --> 00:10:32.215 This instance created with this 'BP_TestActor' Blueprint Class 162 00:10:32.621 --> 00:10:36.179 This instance will move to this location 163 00:10:36.179 --> 00:10:39.192 And it will show us the result of that movement 164 00:10:39.767 --> 00:10:44.373 Such as what the instance has bumped into along the way, for example 165 00:10:45.878 --> 00:10:49.181 And this is how we control a Blueprint 166 00:10:50.613 --> 00:10:54.356 Blueprint Scripting: Basics 167 00:10:55.607 --> 00:11:00.063 Let's now talk about data type and variables 168 00:11:01.498 --> 00:11:06.971 First, data type 169 00:11:07.129 --> 00:11:10.936 Data type and variable 170 00:11:14.550 --> 00:11:17.203 In this system of programming here 171 00:11:17.550 --> 00:11:20.548 There is a concept of an object 172 00:11:21.419 --> 00:11:25.230 What we are doing is an Unreal programming 173 00:11:26.210 --> 00:11:29.585 Unreal uses an object-oriented programming 174 00:11:33.397 --> 00:11:34.706 Or OOP (object-oriented programming) 175 00:11:35.360 --> 00:11:39.059 'Object-oriented' means that we created things in objects 176 00:11:39.059 --> 00:11:43.820 And actualize or process them through their interactions 177 00:11:43.820 --> 00:11:45.734 Among the objects themselves 178 00:11:46.081 --> 00:11:48.050 And what is an object again? 179 00:11:48.050 --> 00:11:53.990 It's a variable created with a data type called class 180 00:11:53.990 --> 00:11:55.965 That's what we call an object 181 00:11:56.737 --> 00:11:59.014 And here, we create such objects 182 00:11:59.460 --> 00:12:07.934 For example, data type includes integer, float or double 183 00:12:11.340 --> 00:12:14.020 So an integer is that divides wholly 184 00:12:14.020 --> 00:12:19.682 Such as -10, 5, or 0; these whole numbers 185 00:12:19.969 --> 00:12:24.069 Natural number without decimal point is called an integer 186 00:12:24.069 --> 00:12:26.316 It could have a sign, such as plus or minus 187 00:12:26.900 --> 00:12:31.983 And the other most widely used data type is float 188 00:12:32.478 --> 00:12:38.900 So for integer, we say int 189 00:12:38.900 --> 00:12:40.886 So this is integer 190 00:12:41.559 --> 00:12:42.831 And this is float 191 00:12:48.019 --> 00:12:52.125 Yes, and then 192 00:12:52.917 --> 00:12:58.660 Let's say this is, for example, -10.5 193 00:12:58.660 --> 00:13:04.516 Or -5.1; something with a decimal point 194 00:13:05.100 --> 00:13:10.271 0 can also be a float, because it could be a 0.0 195 00:13:10.271 --> 00:13:13.119 Of course 0 can both be an integer or a float 196 00:13:14.169 --> 00:13:20.574 And another example, something like 1.2 197 00:13:21.059 --> 00:13:25.051 And there are two types of float 198 00:13:25.773 --> 00:13:28.239 Float is something smaller in scale 199 00:13:28.239 --> 00:13:30.925 And double is another type, that has double the scale 200 00:13:33.698 --> 00:13:35.217 So double is the name for this other data type 201 00:13:36.128 --> 00:13:38.160 So in order to differentiate them 202 00:13:38.160 --> 00:13:40.564 We add an 'f' in the end, like this 203 00:13:41.099 --> 00:13:44.354 Of course with Blueprints we don't really use this 204 00:13:45.027 --> 00:13:48.565 But this is an important concept for coding at C 205 00:13:49.248 --> 00:13:52.815 So with an f, it becomes a float; if not, a double 206 00:13:54.528 --> 00:13:56.655 And there is also a logical data type 207 00:13:58.081 --> 00:14:03.049 We are familiar with the concepts of true and false from our math classes 208 00:14:03.049 --> 00:14:04.730 Hope you remember them 209 00:14:04.938 --> 00:14:10.330 Even at programming, we have True or False for the logical type 210 00:14:10.330 --> 00:14:12.560 This is called a Boolean 211 00:14:16.629 --> 00:14:21.118 Boolean, and in a short form, 'bool' 212 00:14:23.009 --> 00:14:27.361 For C we call it a 'bool' 213 00:14:27.767 --> 00:14:29.470 And for Unreal it just says Boolean 214 00:14:29.470 --> 00:14:34.260 And this data type has two values, True or False 215 00:14:34.260 --> 00:14:38.350 So True and then False 216 00:14:44.013 --> 00:14:50.146 Should I do it again? False; True and False 217 00:14:50.958 --> 00:14:55.016 And we have some texts, such as string 218 00:14:57.628 --> 00:15:00.197 Unreal also has string 219 00:15:03.099 --> 00:15:05.581 String meaning text characters 220 00:15:06.987 --> 00:15:10.820 And there are some more data types 221 00:15:10.820 --> 00:15:14.210 So these are the four representative data types 222 00:15:14.210 --> 00:15:15.202 Shall we move on? 223 00:15:16.509 --> 00:15:17.807 Let's create a variable 224 00:15:18.728 --> 00:15:23.871 To the left, at this window called 'My Blueprint' 225 00:15:23.871 --> 00:15:26.630 We have Variables with a plus sign 226 00:15:26.630 --> 00:15:27.770 Let's click on this 227 00:15:27.770 --> 00:15:29.355 And we get something here 228 00:15:30.920 --> 00:15:33.059 This here says 'Boolean' 229 00:15:33.059 --> 00:15:36.375 Click on this, and we see these data types 230 00:15:36.791 --> 00:15:40.299 It has Byte, Integer64, and much more 231 00:15:40.299 --> 00:15:43.459 These data types allow for integers 232 00:15:44.301 --> 00:15:45.561 The only difference is their sizes 233 00:15:45.650 --> 00:15:49.173 We also see Float here 234 00:15:50.381 --> 00:15:52.141 And then Boolean 235 00:15:53.230 --> 00:15:54.335 As well as String 236 00:15:55.077 --> 00:15:56.344 So these are the different types 237 00:15:56.641 --> 00:16:00.419 And we also see things like Vector or Rotator 238 00:16:00.419 --> 00:16:03.020 Transform, these are also widely used data types 239 00:16:03.020 --> 00:16:06.483 These are some popular data types we see here 240 00:16:06.770 --> 00:16:08.580 And other than these, let's expand on this 241 00:16:08.580 --> 00:16:11.609 We have so many more data types at the bottom 242 00:16:15.194 --> 00:16:15.800 As we see here 243 00:16:15.800 --> 00:16:19.491 Let's start simple, with Integer 244 00:16:19.640 --> 00:16:21.506 Click on Integer 245 00:16:22.110 --> 00:16:24.068 I will name it 'Number' 246 00:16:27.811 --> 00:16:32.342 At Unreal, it's recommended to write the name 247 00:16:33.511 --> 00:16:36.688 Starting with a capital letter for the coding 248 00:16:37.470 --> 00:16:39.330 Of course, this is not mandatory 249 00:16:39.330 --> 00:16:41.313 But we could follow it like this 250 00:16:41.848 --> 00:16:42.979 So the name is 'Number' 251 00:16:42.979 --> 00:16:44.240 Now, let's print it 252 00:16:44.240 --> 00:16:46.665 I'll delete this part, because we already covered this 253 00:16:47.289 --> 00:16:52.712 Let's bring in our Number to Print String 254 00:16:55.850 --> 00:16:57.130 Let's add it like this 255 00:16:57.130 --> 00:16:59.820 See how it is being added like this 256 00:17:00.919 --> 00:17:04.028 And we see some converting nodes in between as well 257 00:17:04.681 --> 00:17:09.217 So this converts an integer value to a string 258 00:17:10.316 --> 00:17:13.939 So we could convert it using these before we add it in 259 00:17:13.939 --> 00:17:15.660 So that's how it works 260 00:17:15.660 --> 00:17:16.888 First, let's compile 261 00:17:17.601 --> 00:17:20.060 And when you select on Number 262 00:17:20.060 --> 00:17:24.540 At the very bottom of Details, we have Default Value 263 00:17:24.540 --> 00:17:26.260 Where we can add some numbers 264 00:17:26.260 --> 00:17:27.974 Let's say that we add 100 265 00:17:28.420 --> 00:17:32.381 This is a value, called 100, added into our variable called Number 266 00:17:35.886 --> 00:17:36.669 That's how it works 267 00:17:36.669 --> 00:17:39.420 Let's come back here and run this 268 00:17:39.420 --> 00:17:41.717 And now we see the number 100 being printed here 269 00:17:44.806 --> 00:17:48.900 Here, the Duration option is only two seconds 270 00:17:48.900 --> 00:17:51.214 Let's make it longer, say 10 seconds 271 00:17:53.195 --> 00:17:54.459 And run it again 272 00:17:54.461 --> 00:17:58.020 We can now see it for 10 seconds here 273 00:18:04.393 --> 00:18:05.500 There could be much more variables 274 00:18:05.500 --> 00:18:06.913 Shall we make something else? 275 00:18:07.507 --> 00:18:08.900 Let's created a float type 276 00:18:08.900 --> 00:18:11.665 So let's select Float 277 00:18:12.318 --> 00:18:17.859 For a float, I guess PI is a float 278 00:18:17.859 --> 00:18:20.874 PI, which is 3.14... 279 00:18:21.567 --> 00:18:22.783 So let's write it here 280 00:18:23.159 --> 00:18:24.884 So right after we create it 281 00:18:25.211 --> 00:18:29.432 And notice how it doesn't have Default Value as it did before 282 00:18:29.640 --> 00:18:32.420 It just says 'Please compile the blueprint' 283 00:18:32.420 --> 00:18:35.934 You need to compile it once before adding any values 284 00:18:37.459 --> 00:18:39.924 Let's just say 3.14 285 00:18:40.548 --> 00:18:42.534 And let's minimize this 286 00:18:42.841 --> 00:18:45.341 Now, let's print this PI 287 00:18:45.539 --> 00:18:48.809 So it changes like this; notice how the converting node changes as well 288 00:18:48.809 --> 00:18:53.291 And the colors; each data type has its own color 289 00:18:53.291 --> 00:18:55.694 So there is a certain color coding system 290 00:18:56.971 --> 00:18:58.659 It this called teal? 291 00:18:58.659 --> 00:19:01.473 And for integer, this is the color 292 00:19:01.780 --> 00:19:04.889 And the green is our float type 293 00:19:04.889 --> 00:19:08.149 And then, for this burgundy type 294 00:19:09.099 --> 00:19:11.772 Or string type, we can add it 295 00:19:13.238 --> 00:19:14.769 And let's run it 296 00:19:14.769 --> 00:19:16.780 We can see it printed here 297 00:19:19.879 --> 00:19:21.800 Let's try a logical type 298 00:19:22.127 --> 00:19:27.696 Here, click on Boolean 299 00:19:28.221 --> 00:19:28.994 And then 300 00:19:31.747 --> 00:19:32.717 How should we name it? 301 00:19:33.420 --> 00:19:36.540 A Boolean basically asks whether it's right or wrong 302 00:19:36.540 --> 00:19:42.309 So we usually use the praxis 'b' 303 00:19:42.309 --> 00:19:49.391 For C too, 'b' is used for Boolean 304 00:19:50.659 --> 00:19:54.352 So we could say 'b' here too 305 00:19:54.620 --> 00:19:55.979 But another way is 306 00:19:55.979 --> 00:19:58.921 We also use 'Is' for Boolean 307 00:19:59.059 --> 00:20:01.475 So 'b' and 'Is' are the two popular ways 308 00:20:02.010 --> 00:20:03.235 I'll go with 'Is' 309 00:20:04.176 --> 00:20:07.370 IsInAir, let's try this 310 00:20:07.370 --> 00:20:09.663 'InAir' as in having jumped, as we will learn later 311 00:20:10.248 --> 00:20:13.333 Jumping up means it is in the air 312 00:20:13.600 --> 00:20:15.160 Are you in the air right now? 313 00:20:15.160 --> 00:20:17.089 That could be the question 314 00:20:17.089 --> 00:20:19.695 So the question will be this, 'IsInAir?' 315 00:20:20.537 --> 00:20:21.395 Let's compile 316 00:20:22.167 --> 00:20:23.647 But we're standing on ground, right? 317 00:20:24.835 --> 00:20:27.224 So for IsInAir, it will be a False 318 00:20:27.699 --> 00:20:30.315 Let's ask, 'IsInAir?' And let's bring it in 319 00:20:32.110 --> 00:20:33.757 And let's add it back here 320 00:20:34.351 --> 00:20:37.639 And notice how the converting node changes too 321 00:20:38.708 --> 00:20:41.225 This converting node here 322 00:20:41.790 --> 00:20:44.260 It changed into red and burgundy 323 00:20:44.260 --> 00:20:45.228 The colors are all different 324 00:20:46.298 --> 00:20:48.779 Let's run it 325 00:20:49.779 --> 00:20:52.124 We see how it prints 'False' 326 00:20:56.857 --> 00:20:58.131 Let's now try a string type 327 00:20:58.596 --> 00:20:59.368 Do this 328 00:21:00.516 --> 00:21:02.730 And choose String 329 00:21:05.879 --> 00:21:09.132 For the name, let's say 'Name' 330 00:21:10.855 --> 00:21:12.163 Compile 331 00:21:12.490 --> 00:21:15.260 Maybe add your name for this Name 332 00:21:15.260 --> 00:21:18.669 I'll use my name here 333 00:21:20.828 --> 00:21:21.775 Compile 334 00:21:23.299 --> 00:21:24.911 Before that, we need to connect it 335 00:21:25.228 --> 00:21:25.780 Bring it in here 336 00:21:25.780 --> 00:21:28.619 You can do this and choose Get 337 00:21:28.619 --> 00:21:31.024 Notice how there are Get and Set 338 00:21:31.370 --> 00:21:32.649 This is how Get looks like 339 00:21:32.649 --> 00:21:34.884 Get is just to bring it in, so it looks like this 340 00:21:35.300 --> 00:21:36.743 Set, meanwhile, looks like this 341 00:21:38.169 --> 00:21:41.859 So for Set, we are adding some extra control for running it 342 00:21:41.859 --> 00:21:44.490 And only when we run it 343 00:21:44.490 --> 00:21:46.459 We add the values in this, which will 344 00:21:46.459 --> 00:21:48.260 Fill the value in this variable called Name 345 00:21:48.260 --> 00:21:49.653 That's what this Set node will do 346 00:21:50.426 --> 00:21:53.119 So we can choose between Get and Set for the node 347 00:21:54.238 --> 00:21:56.296 Let's now print our Name 348 00:21:57.177 --> 00:22:00.411 Name is a string, so it prints right away 349 00:22:02.787 --> 00:22:05.860 And now, run this 350 00:22:06.039 --> 00:22:08.949 We see how it prints the name well 351 00:22:12.939 --> 00:22:13.694 Simple, right? 352 00:22:14.278 --> 00:22:16.511 That's how we create variables 353 00:22:16.689 --> 00:22:19.821 And, if this was a class 354 00:22:19.821 --> 00:22:21.986 This variable would be its attribute 355 00:22:23.649 --> 00:22:26.939 We could also disconnect the node 356 00:22:26.939 --> 00:22:29.474 For example, to disconnect this 357 00:22:29.899 --> 00:22:32.330 If you try this, it would not disconnect 358 00:22:32.330 --> 00:22:34.130 This wouldn't do it 359 00:22:34.338 --> 00:22:37.140 So here, click Alt when you click on it 360 00:22:37.140 --> 00:22:38.344 And this will disconnect it 361 00:22:38.859 --> 00:22:41.599 Or, if you'd rather connect it to something else 362 00:22:41.599 --> 00:22:44.837 For example, to connect Name with Set 363 00:22:45.411 --> 00:22:48.780 Let's say, for this Name 364 00:22:48.780 --> 00:22:50.392 We could add the name directly here 365 00:22:50.680 --> 00:22:52.699 But we could also use this node 366 00:22:52.699 --> 00:22:56.500 To add the name 367 00:22:56.500 --> 00:22:59.496 For which we can simply connect it like this 368 00:23:00.010 --> 00:23:01.819 And with this connection 369 00:23:01.819 --> 00:23:04.983 Later, when the work becomes very complex 370 00:23:05.339 --> 00:23:07.800 You may forget what this is connected to 371 00:23:07.800 --> 00:23:11.150 So for that, go to this connecting part 372 00:23:11.150 --> 00:23:12.900 And while pressing Ctrl 373 00:23:12.900 --> 00:23:15.034 Left-click and drag 374 00:23:15.351 --> 00:23:17.816 And you can move it around like this 375 00:23:18.212 --> 00:23:22.780 Again, with this, press Ctrl 376 00:23:22.780 --> 00:23:25.699 And left click to drag 377 00:23:25.699 --> 00:23:28.360 And you can move it around like so 378 00:23:28.360 --> 00:23:30.481 This is what I recommend you to do 379 00:23:30.699 --> 00:23:31.900 This is a way to do it 380 00:23:34.652 --> 00:23:38.500 And now, let's make this function 381 00:23:38.500 --> 00:23:39.762 This is called function 382 00:23:40.059 --> 00:23:42.326 And for the word function 383 00:23:43.979 --> 00:23:45.912 You can search it up later 384 00:23:46.150 --> 00:23:48.339 Because function is often translated as literally function 385 00:23:48.339 --> 00:23:51.660 While some translations give you the Korean word for function 386 00:23:51.660 --> 00:23:54.467 So function is what acts with a purpose 387 00:23:56.913 --> 00:24:00.099 So let me explain what a function is 388 00:24:00.530 --> 00:24:01.233 Let's move over here 389 00:24:02.569 --> 00:24:04.677 So this is called a function 390 00:24:06.439 --> 00:24:09.375 We are familiar with it from our math classes 391 00:24:10.108 --> 00:24:12.754 It used to be difficult because 392 00:24:13.090 --> 00:24:14.540 We had to deal with some numbers 393 00:24:14.540 --> 00:24:15.935 And it must've been a difficult concept 394 00:24:16.490 --> 00:24:18.739 A function is simply a set which 395 00:24:18.739 --> 00:24:22.219 Transforms an input value 396 00:24:22.219 --> 00:24:24.065 To give you a different output value 397 00:24:24.480 --> 00:24:26.540 That's a simple version of it 398 00:24:26.540 --> 00:24:28.900 We also have in our reality 399 00:24:28.900 --> 00:24:32.193 Something that is similar to a function in how it works 400 00:24:32.450 --> 00:24:34.473 For example, let's say we have 401 00:24:34.968 --> 00:24:35.798 Something like this 402 00:24:39.739 --> 00:24:41.321 I don't know if I'm doing it well 403 00:24:41.548 --> 00:24:43.284 Let's say that we have this thing 404 00:24:43.581 --> 00:24:44.831 Does thie look any familiar? 405 00:24:44.831 --> 00:24:49.718 So let's add an orange here 406 00:24:51.391 --> 00:24:53.071 Let's squeeze this orange in 407 00:24:53.071 --> 00:24:54.488 Then something will come out of this 408 00:24:54.735 --> 00:24:55.741 Some droplets 409 00:24:57.097 --> 00:24:58.227 And what do we call this? 410 00:24:59.128 --> 00:25:00.264 A squeezer 411 00:25:02.779 --> 00:25:04.254 Just like so, a function has 412 00:25:04.650 --> 00:25:08.420 The same form as this squeezer 413 00:25:08.420 --> 00:25:12.610 So that's how a function looks like 414 00:25:12.610 --> 00:25:15.839 So a function has this input area 415 00:25:17.701 --> 00:25:18.251 Input 416 00:25:19.608 --> 00:25:20.329 That's how we write it 417 00:25:21.468 --> 00:25:22.619 There's the input 418 00:25:22.619 --> 00:25:25.100 And over here we have an output 419 00:25:28.407 --> 00:25:31.184 Like so, input an doutput 420 00:25:31.461 --> 00:25:34.059 So with these concepts of input and output 421 00:25:34.059 --> 00:25:35.996 Inside, something is going on 422 00:25:36.670 --> 00:25:38.277 It could be some calculation 423 00:25:38.970 --> 00:25:41.946 Some algorithm, or something else 424 00:25:42.658 --> 00:25:45.500 And after that work, it will return the result 425 00:25:45.500 --> 00:25:47.619 Or there may not be an input 426 00:25:47.619 --> 00:25:49.170 Or there may not be an output 427 00:25:50.140 --> 00:25:52.576 Input and output may or may not be there 428 00:25:53.279 --> 00:25:56.806 So something that looks like this is called a function 429 00:25:58.360 --> 00:26:00.778 Here's how you write the word function 430 00:26:03.758 --> 00:26:05.135 Like so 431 00:26:05.799 --> 00:26:08.456 And now, shall we make a function ourselves? 432 00:26:10.020 --> 00:26:11.807 Let's make a plus function 433 00:26:12.738 --> 00:26:13.516 Come over here 434 00:26:16.279 --> 00:26:19.011 At Functions, we have a plus button 435 00:26:19.011 --> 00:26:20.675 Click on it, and it looks like this 436 00:26:21.041 --> 00:26:22.339 Now we have a function 437 00:26:22.339 --> 00:26:23.693 It's called My Function... 438 00:26:23.961 --> 00:26:26.151 I mean, New Function 439 00:26:26.359 --> 00:26:33.942 Let's make the name for this 'MyAdd' 440 00:26:38.329 --> 00:26:41.546 This will have two integer inputs 441 00:26:42.051 --> 00:26:44.000 And then one integer 442 00:26:44.000 --> 00:26:48.093 It will return an integer, a sum of these two 443 00:26:48.351 --> 00:26:50.604 Let's make this function 444 00:26:51.515 --> 00:26:52.467 See here 445 00:26:53.397 --> 00:26:56.615 This Add function looks like this 446 00:26:57.407 --> 00:26:59.419 And look to the right here 447 00:26:59.419 --> 00:27:02.372 It has the concepts of Input and Output 448 00:27:03.679 --> 00:27:06.300 For Input I will take two 449 00:27:06.300 --> 00:27:07.915 First, an integer 450 00:27:08.361 --> 00:27:10.459 Let's call it 'A' 451 00:27:12.627 --> 00:27:14.571 With that 'A', let's make another one 452 00:27:16.008 --> 00:27:17.869 After you create one, click on the plus sign 453 00:27:17.869 --> 00:27:19.515 And it will create another one with the same type 454 00:27:20.258 --> 00:27:24.441 Let's make an input value called 'B' 455 00:27:24.441 --> 00:27:29.520 These things we add to an input are usually called arguments 456 00:27:29.520 --> 00:27:30.779 This is a function too 457 00:27:30.779 --> 00:27:32.948 So, in eseence, a function is 458 00:27:33.730 --> 00:27:36.154 Something that realizes a particular action 459 00:27:36.540 --> 00:27:39.155 Which uses it by calling it 460 00:27:39.660 --> 00:27:40.889 Now, we're at the creation stage 461 00:27:40.889 --> 00:27:43.542 It doesn't automatically work after we create it 462 00:27:43.760 --> 00:27:48.991 In order to make it work, we need to call this function to use 463 00:27:48.991 --> 00:27:51.311 That's only when this works 464 00:27:51.311 --> 00:27:54.236 So to call it, we add a value 465 00:27:54.920 --> 00:27:57.549 That value is called a parameter 466 00:27:59.895 --> 00:28:01.219 That's what a parameter is 467 00:28:01.219 --> 00:28:02.339 The value, the parameter 468 00:28:02.339 --> 00:28:04.450 And a variable that takes it 469 00:28:04.450 --> 00:28:08.630 This is called an argument 470 00:28:09.590 --> 00:28:10.694 An argument 471 00:28:11.071 --> 00:28:14.859 Left click at 'A' 472 00:28:14.859 --> 00:28:16.893 And drag it out to get this line 473 00:28:17.507 --> 00:28:20.995 And let go to see this menu 474 00:28:21.777 --> 00:28:25.476 Here, search for ' ' and here's 'Add' 475 00:28:25.981 --> 00:28:27.797 There's that node 476 00:28:28.441 --> 00:28:30.820 Click on it, and it looks like this 477 00:28:32.265 --> 00:28:34.380 Notice how this node looks a bit different 478 00:28:34.380 --> 00:28:36.070 This node doesn't have the top area 479 00:28:37.130 --> 00:28:39.074 So it lacks its Execute Pin, right? 480 00:28:39.500 --> 00:28:41.970 This is called a Pure Node 481 00:28:41.970 --> 00:28:45.380 So we can make this a Pure Node as well 482 00:28:45.380 --> 00:28:47.260 At MyAdd, we have this option for 'Pure' 483 00:28:47.260 --> 00:28:50.380 If you click on it, though we don't see it now 484 00:28:50.380 --> 00:28:54.166 It will look a little different when we call it later 485 00:28:54.997 --> 00:28:56.520 I will show you how it works later 486 00:28:56.906 --> 00:28:57.726 And then 487 00:28:59.617 --> 00:29:02.441 Drag out 'B', to mean that we add 'A' and 'B' 488 00:29:02.441 --> 00:29:05.685 Hover your mouse and it says 'Addition' and 'A B' 489 00:29:06.319 --> 00:29:08.219 Meaning, add A and B 490 00:29:08.219 --> 00:29:10.502 And the result will return over here 491 00:29:11.760 --> 00:29:15.532 Click on 'Add pin' and this will add another Input Pin 492 00:29:15.769 --> 00:29:19.994 To delete it, right click and choose 'Remove pin' 493 00:29:20.321 --> 00:29:22.175 That wil delete it 494 00:29:22.581 --> 00:29:24.619 And now we need to print it, but 495 00:29:24.619 --> 00:29:26.060 There is no node that prints it 496 00:29:26.060 --> 00:29:28.835 This is because we haven't done anything to our Output 497 00:29:29.369 --> 00:29:33.484 So let's set Output with Integer 498 00:29:33.850 --> 00:29:35.459 Now we get a node 499 00:29:35.459 --> 00:29:36.790 This is called Return Node 500 00:29:38.156 --> 00:29:43.059 And let's say 'result' here 501 00:29:43.990 --> 00:29:47.104 I keep using small letters for the names 502 00:29:47.569 --> 00:29:49.552 Let's make this a capital letter 503 00:29:50.107 --> 00:29:52.483 Now we connect this 504 00:29:54.087 --> 00:29:57.253 Now we have created a function 505 00:30:00.897 --> 00:30:02.811 We can also add a Comment here 506 00:30:02.811 --> 00:30:05.900 To do so, you can either click on the background 507 00:30:05.900 --> 00:30:07.670 Anywhere you want, click on it 508 00:30:08.551 --> 00:30:10.540 And press 'C' on your keyboard 509 00:30:10.540 --> 00:30:12.137 This will create a Comment 510 00:30:12.929 --> 00:30:15.339 That's how you can group them together 511 00:30:15.339 --> 00:30:16.924 Now they move together like so 512 00:30:17.270 --> 00:30:20.422 This is a useful thing to use as well 513 00:30:20.729 --> 00:30:28.951 And here, let's write 514 00:30:28.951 --> 00:30:30.927 This function adds two integers' 515 00:30:31.600 --> 00:30:34.418 This part is optional, I just did it 516 00:30:35.349 --> 00:30:36.163 So let's compile 517 00:30:36.401 --> 00:30:37.510 To go back 518 00:30:38.411 --> 00:30:40.819 You can click on this Event Graph 519 00:30:40.819 --> 00:30:44.567 And you may make a mistake and close this window 520 00:30:45.567 --> 00:30:47.741 In that case, go to this 'EventGraph' 521 00:30:49.028 --> 00:30:51.777 Double click on this to open the tab again 522 00:30:52.856 --> 00:30:54.792 That's how you get here again 523 00:30:55.208 --> 00:30:59.615 This looks like this for now, and let me move this a little 524 00:31:00.377 --> 00:31:01.561 And let me disconnect this 525 00:31:01.561 --> 00:31:05.776 We only had that to see what a variable is 526 00:31:06.460 --> 00:31:08.279 And for our function, like so 527 00:31:10.259 --> 00:31:11.579 Here we have MyAdd 528 00:31:11.579 --> 00:31:14.736 Click on it, drag and drop here to have it here 529 00:31:15.647 --> 00:31:18.020 Now click on this, and to the right, we have 'Pure' 530 00:31:18.020 --> 00:31:20.177 Click on 'Pure' and it changes like this 531 00:31:21.177 --> 00:31:23.478 'Pure' decides whehter to have its Execute Pin 532 00:31:24.567 --> 00:31:26.531 Or to not have its Execute Pin 533 00:31:28.818 --> 00:31:30.485 I will keep it here 534 00:31:30.780 --> 00:31:33.579 And now we connect it and add the value 535 00:31:33.579 --> 00:31:35.459 You can write it directly here 536 00:31:35.459 --> 00:31:40.630 You can add thing slike 10, 20 537 00:31:40.630 --> 00:31:43.443 Or, since we have a variable called Number 538 00:31:43.760 --> 00:31:46.401 We can bring this in here like so 539 00:31:47.530 --> 00:31:49.736 That will add the values 540 00:31:52.577 --> 00:31:54.540 And let's print it here 541 00:31:54.540 --> 00:31:57.219 We will use this Print String 542 00:31:57.219 --> 00:31:59.289 Let's copy this in 543 00:31:59.517 --> 00:32:01.182 Select our Print String 544 00:32:01.182 --> 00:32:06.761 Ctrl C and Ctrl V to copy and paste 545 00:32:09.840 --> 00:32:14.280 Ctrl D is for duplicate 546 00:32:14.280 --> 00:32:17.573 So Ctrl D will duplicate it 547 00:32:18.187 --> 00:32:19.824 You can choose whichever is more convenient for you 548 00:32:20.448 --> 00:32:22.579 Let's print it now 549 00:32:22.579 --> 00:32:23.995 Connect it like so 550 00:32:24.471 --> 00:32:26.633 And connect our Result part to this 551 00:32:26.831 --> 00:32:29.459 Now, as we have seen before 552 00:32:29.459 --> 00:32:33.618 Like so, the converting node is automatically created 553 00:32:35.588 --> 00:32:39.096 Now compile and run 554 00:32:39.828 --> 00:32:41.640 Now we have this value 120 printed here 555 00:32:41.640 --> 00:32:43.363 Remember, we added 100 for Number 556 00:32:43.650 --> 00:32:45.592 So 100 plus 20 equals 557 00:32:45.899 --> 00:32:49.462 This printed value, 120 558 00:32:49.868 --> 00:32:51.539 That's what a function is 559 00:32:54.001 --> 00:33:00.720 Now, I have this red 'Event Begin Play' 560 00:33:00.720 --> 00:33:01.595 So this is 561 00:33:03.041 --> 00:33:04.962 An Actor is actually born 562 00:33:07.091 --> 00:33:08.511 Right over here 563 00:33:08.511 --> 00:33:11.315 So everything over here 564 00:33:13.206 --> 00:33:16.250 In a way, I mean, they are not living beings 565 00:33:16.250 --> 00:33:18.640 But you can consider them as one 566 00:33:18.640 --> 00:33:21.814 Meaning, an Actor is something born in a Level 567 00:33:23.496 --> 00:33:26.923 And this is what I made, a Blueprint 568 00:33:26.923 --> 00:33:28.459 But I can take another out 569 00:33:28.459 --> 00:33:30.312 Now we have two of this 570 00:33:30.471 --> 00:33:32.091 When I was talking about Class 571 00:33:32.091 --> 00:33:34.490 I said one is Hong Gil-Dong, another Lee Young-Hoon 572 00:33:34.490 --> 00:33:37.350 So this is Hong, and this is Lee; that's how it works 573 00:33:37.350 --> 00:33:42.962 Meaning, even on the same Class, there can be different objects 574 00:33:44.209 --> 00:33:46.828 That's how it works 575 00:33:47.877 --> 00:33:51.824 So this instance is now born here 576 00:33:52.210 --> 00:33:55.510 Notice how I'm using 'object' and 'instance' to mean the same thing 577 00:33:55.510 --> 00:33:57.713 They are interchangeable 578 00:33:58.020 --> 00:34:00.460 So do not be confused 579 00:34:00.460 --> 00:34:02.557 Object and instance, they are similar 580 00:34:03.210 --> 00:34:04.579 They are not exactly the same 581 00:34:04.579 --> 00:34:07.565 But they are referring to the same thing 582 00:34:08.337 --> 00:34:14.292 So anyways, they are born, and they die 583 00:34:14.490 --> 00:34:15.699 Something may collide into it 584 00:34:15.699 --> 00:34:19.981 And basically, what we have is after they are born 585 00:34:19.981 --> 00:34:21.501 So it's called an event 586 00:34:21.501 --> 00:34:24.130 When it is born, an event occurs 587 00:34:24.130 --> 00:34:26.506 So this event is called 'Begin Play' 588 00:34:27.011 --> 00:34:32.461 And the event during its life, we have Event Tick 589 00:34:32.461 --> 00:34:34.365 Tick repeats itself every time 590 00:34:34.741 --> 00:34:36.702 While this is only called once, when it is born 591 00:34:36.890 --> 00:34:38.286 This keeps getting called in 592 00:34:38.840 --> 00:34:41.513 And then, though we don't have it here 593 00:34:41.800 --> 00:34:47.491 We also have something called 'End Play' 594 00:34:47.491 --> 00:34:50.070 Event End Play, this is 595 00:34:51.010 --> 00:34:55.310 This node, or event, is called when it gets destroyed 596 00:34:56.508 --> 00:35:04.550 We also have 'Destroyed' 597 00:35:06.600 --> 00:35:08.583 Something called 'Event Destroyed' 598 00:35:08.583 --> 00:35:13.221 So this node is also called in when it is destroyed 599 00:35:14.716 --> 00:35:15.741 There's that 600 00:35:15.870 --> 00:35:19.240 And we also have 'Event ActorBeginOverlap' 601 00:35:19.240 --> 00:35:21.156 This is used when 602 00:35:22.008 --> 00:35:25.038 You know, we bump into many things in real life 603 00:35:25.038 --> 00:35:26.780 Right? We would bump into many things 604 00:35:26.780 --> 00:35:31.152 Just like that, this Actor can bump into some other Actor 605 00:35:31.261 --> 00:35:33.654 And this node will capture such things 606 00:35:34.347 --> 00:35:35.260 That's what it is 607 00:35:35.260 --> 00:35:37.538 And I just want it printed once when it is born 608 00:35:38.330 --> 00:35:40.125 So these are printed here 609 00:35:40.521 --> 00:35:46.295 If this is printed here, at Tick 610 00:35:47.661 --> 00:35:52.860 If it is printed at Tick, this is how it looks like 611 00:35:52.890 --> 00:35:56.462 It will keep getting called in 612 00:36:05.977 --> 00:36:10.169 So to go back, this is how we create a function 613 00:36:10.169 --> 00:36:13.926 And we can call this in order to use it 614 00:36:15.471 --> 00:36:19.689 So this is how we create functions at Blueprint 615 00:36:19.689 --> 00:36:21.863 This is their mechanism 616 00:36:23.150 --> 00:36:25.253 And then we call it in 617 00:36:25.620 --> 00:36:28.540 So here, we have created this function 618 00:36:28.540 --> 00:36:31.139 Which looks the same as these other nodes 619 00:36:31.139 --> 00:36:33.153 So a node is, in a way 620 00:36:33.401 --> 00:36:35.652 Very similar to a function 621 00:36:36.771 --> 00:36:39.770 Of course, these nodes are not a function 622 00:36:40.642 --> 00:36:43.739 We have a variable node, and then a function node 623 00:36:43.739 --> 00:36:45.801 That's a way to distinguish them 624 00:36:45.801 --> 00:36:49.191 But to be exact, they are the same nodes 625 00:36:50.369 --> 00:36:54.630 Let's now move on to conditional statement (Branch/Switch) and iteration (Loop) 626 00:36:54.630 --> 00:36:55.785 Let's do it together 627 00:36:56.418 --> 00:36:58.120 Now, let's undo BeginPlay 628 00:36:58.120 --> 00:36:59.778 Let's move it over here 629 00:37:00.501 --> 00:37:02.632 Let's start with the conditional statement 630 00:37:12.988 --> 00:37:14.053 So, conditional statement 631 00:37:17.251 --> 00:37:19.082 This is what it is 632 00:37:19.211 --> 00:37:26.916 If, and then 633 00:37:30.421 --> 00:37:31.820 This is the condition 634 00:37:31.820 --> 00:37:36.367 And if that condition is met, this will happen 635 00:37:37.060 --> 00:37:38.419 And it may not be met 636 00:37:38.419 --> 00:37:40.612 If so, then so happens 637 00:37:40.870 --> 00:37:49.719 Or, if not so, then so happens 638 00:37:51.610 --> 00:37:53.196 This can work as well 639 00:37:53.711 --> 00:37:56.259 Or we can also do this 640 00:37:57.120 --> 00:37:58.609 While this has two conditions 641 00:37:59.590 --> 00:38:01.313 We can also have three 642 00:38:01.471 --> 00:38:16.233 If not so and instead so, then so happens 643 00:38:18.757 --> 00:38:22.671 There can be two conditions like this 644 00:38:22.810 --> 00:38:28.033 Or more than three can work 645 00:38:28.320 --> 00:38:31.833 Yet Blueprint has different categories for this 646 00:38:32.160 --> 00:38:35.721 So a node can handle two conditions 647 00:38:35.929 --> 00:38:38.020 And another node can handle three or more 648 00:38:38.020 --> 00:38:39.085 That's how it works 649 00:38:40.471 --> 00:38:43.920 Of course, if you have experience in coding 650 00:38:43.920 --> 00:38:46.951 You know, there's the 'if statement' 651 00:38:46.951 --> 00:38:48.363 If, else 652 00:38:51.066 --> 00:38:52.766 If and else statements 653 00:38:53.340 --> 00:38:57.184 And we also have 'else if' as well 654 00:38:59.471 --> 00:39:02.384 So with these keywords 655 00:39:02.740 --> 00:39:04.293 We can run a branch statement 656 00:39:04.689 --> 00:39:07.286 But at Blueprint, this part is a little different 657 00:39:07.979 --> 00:39:10.302 When we get to C later, it will work like so 658 00:39:10.451 --> 00:39:12.329 But at Blueprint, it is run a bit differently 659 00:39:12.329 --> 00:39:14.278 So let's now 660 00:39:15.000 --> 00:39:17.298 Learn about how we do it 661 00:39:20.348 --> 00:39:23.172 Let's type in 'if' here 662 00:39:23.360 --> 00:39:26.219 And we don't get 'if', instead 'Branch' 663 00:39:26.219 --> 00:39:29.932 See how a node branches into two 664 00:39:30.268 --> 00:39:31.593 So this is a Branch 665 00:39:32.989 --> 00:39:34.679 We can connect it like this 666 00:39:35.461 --> 00:39:39.340 Meaning, every time it is born, it checks for the Branch condition 667 00:39:39.340 --> 00:39:41.134 Condition is what makes it conditional 668 00:39:41.738 --> 00:39:43.971 And it says 'True' for all conditions 669 00:39:43.971 --> 00:39:45.996 So Condition is obviously a Boolean 670 00:39:47.619 --> 00:39:50.089 Now, shall we do this? 671 00:39:50.089 --> 00:39:51.132 Let's use this 672 00:39:51.389 --> 00:39:54.391 We can simply drag it in like this 673 00:39:54.391 --> 00:39:58.285 'Is in Air', if it's True, it signals this way 674 00:39:58.711 --> 00:40:01.164 If False, it signals this way 675 00:40:02.798 --> 00:40:09.300 Let's make two different Print Strings 676 00:40:10.121 --> 00:40:12.412 Like so, and like so 677 00:40:14.996 --> 00:40:24.108 Here, 'It is in air' and here, 'It is on the ground' 678 00:40:28.128 --> 00:40:29.827 These are the conditions 679 00:40:34.817 --> 00:40:38.223 Here, what is 'Is In Air'? 680 00:40:39.758 --> 00:40:41.142 It is False 681 00:40:41.528 --> 00:40:42.941 Now let's run this 682 00:40:44.169 --> 00:40:45.401 We see 'It's on the ground' 683 00:40:45.401 --> 00:40:48.759 Because 'Is In Air' is False, it's not in air 684 00:40:52.610 --> 00:40:54.985 But if 'Is In Air' is True 685 00:40:57.550 --> 00:41:01.885 It branches instead into 'It is in air' 686 00:41:04.518 --> 00:41:07.780 And, I'm going back and forth 687 00:41:07.780 --> 00:41:09.543 And you may be thinking 688 00:41:09.751 --> 00:41:12.684 That I could just work on it here 689 00:41:13.050 --> 00:41:13.899 I can do that 690 00:41:13.899 --> 00:41:17.100 So, with this varibale 'Is In Air' 691 00:41:17.100 --> 00:41:19.820 To its right, there's an eye icon 692 00:41:19.820 --> 00:41:21.219 And once we open this eye 693 00:41:22.486 --> 00:41:29.780 To the right, under Details, 'Instance Editable' is now on 694 00:41:29.780 --> 00:41:31.897 See that? It is synced 695 00:41:32.946 --> 00:41:36.604 Instance is, I said this here is the Instance 696 00:41:37.080 --> 00:41:40.800 So it means that we can directly edit it at Instance 697 00:41:42.345 --> 00:41:45.234 Let's now open this eye here 698 00:41:46.263 --> 00:41:50.989 And click on this 'BP_TextActor' 699 00:41:50.989 --> 00:41:53.973 At Details, 'Is In Air' is right here 700 00:41:54.805 --> 00:41:57.048 See? Let's try turning it off 701 00:41:58.256 --> 00:42:00.726 Turn it off, and now compile it 702 00:42:01.676 --> 00:42:03.666 Compile, and we don't see it here 703 00:42:04.369 --> 00:42:08.431 Like that, we can use our thing at Instance directly 704 00:42:08.431 --> 00:42:10.197 Through thi smenu 705 00:42:11.137 --> 00:42:13.805 Anyways, that was conditional statement 706 00:42:14.518 --> 00:42:18.179 But instead of branching conditions into two 707 00:42:18.179 --> 00:42:21.973 For multiple conditions, we use a Switch 708 00:42:22.300 --> 00:42:25.590 Then, for this particular logical type 709 00:42:25.590 --> 00:42:27.429 A Switch may not be appropriate 710 00:42:27.429 --> 00:42:29.414 Instead, this is how we use a Switch 711 00:42:30.850 --> 00:42:32.339 Let me try it with Number 712 00:42:32.339 --> 00:42:35.637 With Number, let's look for Switch 713 00:42:41.360 --> 00:42:44.070 Here's 'Switch on Int' 714 00:42:44.070 --> 00:42:45.739 And we have it like this 715 00:42:46.828 --> 00:42:47.820 And we have a Pin here 716 00:42:47.820 --> 00:42:49.902 Click it, and this Pin changes 717 00:42:50.268 --> 00:42:51.567 It multiplies itself like this 718 00:42:52.210 --> 00:42:55.032 So, if I have 0 for Number 719 00:42:55.300 --> 00:42:57.780 Or 1, or 2, or 3 720 00:42:57.780 --> 00:43:00.540 According to this value at Number 721 00:43:00.540 --> 00:43:02.657 We can make it switch 722 00:43:04.776 --> 00:43:07.139 So for three or more options 723 00:43:07.139 --> 00:43:08.595 We use Switch 724 00:43:09.060 --> 00:43:14.704 So at Blueprint, we use Branch for two conditions 725 00:43:15.020 --> 00:43:19.026 And Switch for multiple 726 00:43:20.868 --> 00:43:21.609 It's simple 727 00:43:23.946 --> 00:43:25.260 That was conditional statement 728 00:43:25.260 --> 00:43:27.724 And, I'd rather leave it here 729 00:43:28.090 --> 00:43:31.255 Now, let's go up, and finally 730 00:43:31.790 --> 00:43:33.917 Le'ts now talk about iterations 731 00:43:35.788 --> 00:43:37.026 So we have iterations 732 00:43:40.798 --> 00:43:44.075 That literally repeat the same thing 733 00:43:44.550 --> 00:43:48.253 So it repeats 734 00:43:49.451 --> 00:43:53.657 It has a beginning and an end 735 00:43:55.261 --> 00:43:57.340 So between its start and its end 736 00:43:57.340 --> 00:43:59.156 Something must go on here 737 00:43:59.721 --> 00:44:04.003 And for that progression, there is a concept called Index 738 00:44:06.290 --> 00:44:08.513 Index is usually written as 'i' 739 00:44:08.830 --> 00:44:10.750 Its 'i' is increased by one 740 00:44:10.750 --> 00:44:13.894 So when it starts, there's the starting value for 'i' 741 00:44:14.300 --> 00:44:17.327 And then the ending value 742 00:44:17.971 --> 00:44:20.647 For example, if it starts at 0 and ends at 9 743 00:44:21.281 --> 00:44:24.343 Is there too many? Let's say it ends at 3 744 00:44:24.640 --> 00:44:25.979 From 0 to 3 745 00:44:25.979 --> 00:44:34.815 Then it starts with 0, 1, 2, and 3; it repeats four times and it ends 746 00:44:35.320 --> 00:44:36.547 That's an iteration 747 00:44:37.438 --> 00:44:39.213 So how does this work? 748 00:44:40.451 --> 00:44:44.263 Here, search for 'for' and we have it here 749 00:44:44.540 --> 00:44:46.605 Let's go for 'For Loop' 750 00:44:48.298 --> 00:44:49.251 And we have these things 751 00:44:49.350 --> 00:44:53.286 We have 'Each Loop' as well as 'For Loop' 752 00:44:54.137 --> 00:44:55.011 And so many more 753 00:44:55.659 --> 00:45:00.771 Basically, 'For Loop' is the index-based repetition I just talked about 754 00:45:00.939 --> 00:45:04.253 We have First and Last Index 755 00:45:04.600 --> 00:45:07.897 If we want to repeat it 10 times, it will be from 0 to 9 756 00:45:08.530 --> 00:45:11.032 From 1 to 10 is 10 times, and if we subtract one for each 757 00:45:11.032 --> 00:45:12.810 It is from 0 to 9 758 00:45:16.256 --> 00:45:19.100 Let's now print it 759 00:45:19.100 --> 00:45:21.703 Let's use the same Print String 760 00:45:25.317 --> 00:45:29.100 And this will print it 761 00:45:29.100 --> 00:45:32.273 At Output Pin, it has Loop Body, 762 00:45:32.540 --> 00:45:34.153 Index, and Completed 763 00:45:34.470 --> 00:45:40.239 Completed is, of course, called in after this Index is run 764 00:45:41.021 --> 00:45:45.733 From 0 to 9; it's the result 765 00:45:46.100 --> 00:45:50.751 Loop Body is, every time it increases, it gets into this one 766 00:45:50.830 --> 00:45:53.961 Meaning, it calls 10 times 767 00:45:53.961 --> 00:45:55.501 Meaning, it prints 10 times 768 00:45:56.650 --> 00:45:59.654 So for example, let me connect it here 769 00:46:00.050 --> 00:46:02.292 And it now prints the Index value 770 00:46:03.461 --> 00:46:05.773 And then, let's try this 771 00:46:07.368 --> 00:46:10.177 Then it will print from 0 to 9 772 00:46:11.117 --> 00:46:12.203 Let's run it here 773 00:46:12.530 --> 00:46:15.078 Here, let's now... 774 00:46:16.088 --> 00:46:17.246 Let's increase its Duration a little 775 00:46:23.057 --> 00:46:24.206 And here, let's run it 776 00:46:25.097 --> 00:46:27.459 0 is at the bottom, and 9 at the top 777 00:46:27.459 --> 00:46:31.263 It's because the most recently printed one is at the top 778 00:46:31.451 --> 00:46:33.421 So 0 is what started with 779 00:46:33.421 --> 00:46:34.979 And 9 is the last one 780 00:46:36.127 --> 00:46:37.026 That's how it works 781 00:46:37.709 --> 00:46:41.038 And let's say I now connect it to Completed 782 00:46:44.820 --> 00:46:47.184 Then it will only print this 10 783 00:46:48.739 --> 00:46:53.724 Because, until 9, this Index will be printed through Loop Body 784 00:46:54.041 --> 00:46:57.981 And Completed is what comes after 10 785 00:46:57.981 --> 00:46:59.694 It doesn't count that, so 786 00:47:00.209 --> 00:47:03.288 We can say it has repeated 10 times 787 00:47:04.221 --> 00:47:08.320 So for Completed, this Index is 788 00:47:08.320 --> 00:47:13.003 Last Index 1, that value is printed here 789 00:47:13.310 --> 00:47:16.897 This can show us the acts that have been repeated 790 00:47:18.649 --> 00:47:21.820 Now let's use this for a simple example 791 00:47:22.187 --> 00:47:24.602 Something very simple is 792 00:47:24.691 --> 00:47:27.495 We can only print even numbers 793 00:47:28.169 --> 00:47:32.652 So for now, it is printing all numbers 794 00:47:32.791 --> 00:47:35.384 But let's make it only print even numbers 795 00:47:38.057 --> 00:47:39.973 Meaning, we need some filtering 796 00:47:40.141 --> 00:47:43.780 Based on the number of Index now 797 00:47:43.780 --> 00:47:46.045 It should decide whether to print the value 798 00:47:46.758 --> 00:47:48.056 Let's keep this 799 00:47:49.808 --> 00:47:53.927 In between here, if the current Index value is even, pass 800 00:47:54.650 --> 00:47:56.937 And if not, don't pass 801 00:47:58.759 --> 00:48:04.230 So the signal at Loop Body, the input control should 802 00:48:04.230 --> 00:48:06.244 Reach here to be printed 803 00:48:06.531 --> 00:48:08.127 So we can just stop it here 804 00:48:09.068 --> 00:48:14.041 And this will only allow Index to pass if it is even 805 00:48:14.041 --> 00:48:16.904 The difference between an odd and an even number is 806 00:48:17.360 --> 00:48:21.904 When divided by 2, if it has 0 remainder, even and if it has 1 remainder, odd 807 00:48:22.617 --> 00:48:24.344 Let's do some division 808 00:48:24.721 --> 00:48:27.211 There's an algorithm for remainder 809 00:48:27.211 --> 00:48:29.577 Called %, divided by 2 810 00:48:30.716 --> 00:48:34.886 So dividing Index by 2, if this shows 0 811 00:48:36.183 --> 00:48:40.144 It's asking here, 'is this equal to this?' 812 00:48:45.045 --> 00:48:48.003 Then here, we need a Branch 813 00:48:48.944 --> 00:48:55.459 Let's use a Branch 814 00:49:04.350 --> 00:49:05.813 And this is how it can work 815 00:49:07.318 --> 00:49:09.443 So let's disconnect it, and connect it here 816 00:49:09.721 --> 00:49:11.271 And then here, let's add it here 817 00:49:13.588 --> 00:49:18.090 Now, this only prints the value if it is even 818 00:49:18.347 --> 00:49:19.874 Let's compile and run it 819 00:49:21.449 --> 00:49:27.150 Now, 0 is also an even number, so this works 820 00:49:31.338 --> 00:49:37.449 So that was on conditional statements and iterations 821 00:49:37.449 --> 00:49:40.099 In fact, there are more operators 822 00:49:40.099 --> 00:49:42.145 This is called Comparison Operator 823 00:49:42.590 --> 00:49:46.041 A Comparison Operator asks, 'equal to or bigger?' 824 00:49:46.041 --> 00:49:49.885 Or 'equal to or smaller?' or 'smaller?' 825 00:49:50.231 --> 00:49:55.211 Less, Less Equal, and we have Greater, Greater Equal 826 00:49:55.271 --> 00:49:58.753 We are familiar with these, less, less or equal to, and so forth 827 00:49:59.397 --> 00:50:00.614 That's a way to compare 828 00:50:00.961 --> 00:50:06.780 And, we could also make it work if two conditions are met 829 00:50:06.780 --> 00:50:07.802 That's an option 830 00:50:07.970 --> 00:50:15.590 If it extends until 9 831 00:50:16.481 --> 00:50:19.996 We can only print those smaller than 5 832 00:50:20.927 --> 00:50:24.045 Then this needs two conditions 833 00:50:25.758 --> 00:50:28.545 This condition for even numbers 834 00:50:30.109 --> 00:50:31.780 And we have another condition here 835 00:50:31.780 --> 00:50:36.770 This, 'Less' compared to 5 836 00:50:36.770 --> 00:50:43.031 Less, and the condition, 'is this less than 5?' 837 00:50:43.031 --> 00:50:44.765 These are the two conditions needed 838 00:50:45.270 --> 00:50:49.382 So if both conditions are true, that's True 839 00:50:49.640 --> 00:50:52.394 And if either is false, this is False 840 00:50:52.840 --> 00:50:56.645 And we can use an operator here as well 841 00:50:58.160 --> 00:51:01.622 This is called Logical Operators 842 00:51:02.453 --> 00:51:04.252 Let's use that 843 00:51:07.629 --> 00:51:08.538 So for operators 844 00:51:12.449 --> 00:51:13.315 Let's say this 845 00:51:13.701 --> 00:51:15.256 We have two set groups 846 00:51:15.949 --> 00:51:22.100 And if we limit the result to 'only when both are true' 847 00:51:22.100 --> 00:51:23.340 It's this central part 848 00:51:24.360 --> 00:51:29.032 For the two conditional statements, A and B 849 00:51:29.300 --> 00:51:32.291 If it is only true when both are true 850 00:51:32.291 --> 00:51:34.434 Then for the group, this is the place 851 00:51:35.108 --> 00:51:36.996 This is called a union 852 00:51:37.580 --> 00:51:39.753 I mean, an intersection 853 00:51:42.961 --> 00:51:46.147 Intersection is what we are familiar with 854 00:51:46.820 --> 00:51:49.345 Remember this sign? This is an intersectino 855 00:51:50.018 --> 00:51:52.699 And in order to memorize this sign, I learned to 856 00:51:52.699 --> 00:51:55.939 Make this look like 'and' in Korean, like this 857 00:51:55.939 --> 00:51:58.010 So I did this to memorize this 'And' 858 00:51:59.209 --> 00:52:00.246 'And' as an intersection 859 00:52:01.355 --> 00:52:05.300 It uses two ampersands as its sign, like so: && 860 00:52:06.260 --> 00:52:07.241 And a union 861 00:52:07.330 --> 00:52:10.550 So for two groups, we fill it all 862 00:52:10.600 --> 00:52:17.189 Meaning, it's all true if at least one is true 863 00:52:19.298 --> 00:52:20.558 That's a union 864 00:52:23.310 --> 00:52:26.756 And this is the sign for a union 865 00:52:27.588 --> 00:52:28.740 For this, I memorized it like this 866 00:52:28.740 --> 00:52:34.451 'Or' in Korean, to memorize 'or' 867 00:52:37.412 --> 00:52:39.684 For the sign, it looks like... 868 00:52:40.060 --> 00:52:43.426 Do you see the sign right above your Enter on your keyboard? 869 00:52:44.060 --> 00:52:46.986 On your keyboard, there's your Enter 870 00:52:48.659 --> 00:52:51.286 And right above that, though it may vary 871 00:52:51.860 --> 00:52:54.470 There's this button that looks like this 872 00:52:54.470 --> 00:52:56.573 Which has this sign like this 873 00:52:56.870 --> 00:52:58.609 This is the sign for 'or' 874 00:52:58.609 --> 00:53:02.776 It is not a straight line like this 875 00:53:03.390 --> 00:53:05.060 It's actually two line with a space in between 876 00:53:05.060 --> 00:53:07.937 So that's the 'or' sign, || 877 00:53:08.640 --> 00:53:09.569 We use two 878 00:53:10.708 --> 00:53:15.285 So for this example, we are using an intersection, an 'and' 879 00:53:15.740 --> 00:53:22.117 Meaning, it's only true if both A and B are true 880 00:53:23.998 --> 00:53:25.454 That's what we're making here 881 00:53:25.751 --> 00:53:30.072 So when divided by 2, the remainder is 0 882 00:53:30.250 --> 00:53:34.214 And it is smaller than 5; that's the condition we have 883 00:53:34.541 --> 00:53:39.927 So let's choose 'And Boolean' 884 00:53:40.748 --> 00:53:43.213 Complete it like this 885 00:53:45.451 --> 00:53:47.764 And adding this as the condition will 886 00:53:48.130 --> 00:53:51.068 Only print it when both are true 887 00:53:52.335 --> 00:53:54.323 Let's compile and run 888 00:53:54.878 --> 00:53:56.738 See how it doesn't print anything bigger than 5 889 00:54:03.857 --> 00:54:08.018 Today we looked at Blueprint 890 00:54:10.751 --> 00:54:13.949 Let's sum what we've learned today 891 00:54:14.560 --> 00:54:18.060 Coding and Visual Scripting Create Actor Blueprint to set in World 892 00:54:18.060 --> 00:54:21.520 Create Printstring node, connect Output Pin to Event Beginplay node to print HelloWorld 893 00:54:21.520 --> 00:54:23.664 Basics of Blueprint Scripting Pin of Blueprint Node Execute Pin, Input Pin, Output Pin Variable Attribute of a Class 894 00:54:23.664 --> 00:54:26.137 Use Variable to declare a variable Connect to PrintString Node to print on screen Variable Method of a Class 895 00:54:26.137 --> 00:54:28.540 Use Function button to add Add function, set Input and Output At Event BeginPlay Node, connect Add function and print 896 00:54:28.540 --> 00:54:31.011 Basics of Blueprint Scripting Conditional Statement Compare two values and print or print after checking if the values are the same 897 00:54:31.011 --> 00:54:33.513 Iteration Create For Loop Node, connect to Event BeginPlay Node, set Index value 898 00:54:33.513 --> 00:54:35.501 Connect Add function node and variable node, use Print String node to print