WEBVTT 1 00:00:28.310 --> 00:00:30.699 Hello, this is Younghoon Lee 2 00:00:30.950 --> 00:00:36.050 We're going to learn about bullet firing and the spawn system in this session 3 00:00:36.119 --> 00:00:37.630 In this chapter 4 00:00:37.631 --> 00:00:40.781 You will learn how to move bullet actor in C++ 5 00:00:41.132 --> 00:00:43.082 And how to Spawn bullet actor 6 00:00:43.083 --> 00:00:46.933 According to the user's input 7 00:00:46.933 --> 00:00:52.769 Also, you will learn how to play audio file in C++ as well 8 00:00:53.270 --> 00:00:56.220 Bullet actor and moving it, Handing input, Firing 9 00:00:58.080 --> 00:01:01.240 Let's build the bullet to begin with 10 00:01:01.691 --> 00:01:03.641 Just like before 11 00:01:04.760 --> 00:01:08.590 Create a new actor 12 00:01:08.591 --> 00:01:12.391 From Tools in new C++ class 13 00:01:12.919 --> 00:01:17.680 And I will name it BulletActor 14 00:01:18.680 --> 00:01:21.400 BulletActor 15 00:01:28.900 --> 00:01:32.959 The bullets will need a collision object and appearance as well 16 00:01:32.959 --> 00:01:36.219 Let's repeat what we did 17 00:01:36.219 --> 00:01:38.820 When we made the player 18 00:01:41.000 --> 00:01:44.279 Go to bullet's header first 19 00:01:44.280 --> 00:01:50.230 Let me declare the components in order to create 20 00:01:51.279 --> 00:01:53.500 The collision object and appearance first 21 00:01:53.501 --> 00:01:58.351 Write in UPROPERTY 22 00:01:58.400 --> 00:02:02.040 And then EditAnywhere 23 00:02:04.839 --> 00:02:07.200 Do a forward declaration 24 00:02:07.201 --> 00:02:11.451 Write class UBoxComponent 25 00:02:15.449 --> 00:02:19.089 And then BoxComp 26 00:02:19.089 --> 00:02:23.309 And we need a component for appearance as well 27 00:02:23.310 --> 00:02:24.310 UPROPERTY 28 00:02:26.540 --> 00:02:29.399 EditAnywhere 29 00:02:30.320 --> 00:02:35.360 Then, declare UStaticComponent, like this 30 00:02:39.360 --> 00:02:44.720 I meant StaticMeshComponent 31 00:02:44.820 --> 00:02:47.959 It's always better if you use the autocomplete 32 00:02:48.860 --> 00:02:53.160 Write MeshComp 33 00:02:55.919 --> 00:03:01.479 Now let's move on to 34 00:03:01.479 --> 00:03:03.130 The source file 35 00:03:03.679 --> 00:03:08.000 I'll do the same thing in the constructor 36 00:03:10.950 --> 00:03:13.199 BoxComp 37 00:03:13.199 --> 00:03:20.039 create DefaultSubobject UBoxComponent 38 00:03:20.039 --> 00:03:22.510 Let me clarify again 39 00:03:23.061 --> 00:03:27.661 components typically use U as a prefix 40 00:03:32.160 --> 00:03:34.800 Like this 41 00:03:34.800 --> 00:03:37.669 I will add BoxComp add here as well 42 00:03:37.670 --> 00:03:41.220 And then I will set this as root component 43 00:03:41.220 --> 00:03:45.119 SetRootComponent 44 00:03:51.969 --> 00:03:54.080 Then we need to add header now 45 00:03:54.680 --> 00:03:59.360 For convenience, I'll use this to work quickly 46 00:03:59.360 --> 00:04:04.800 Add the header into UBoxComponent 47 00:04:04.800 --> 00:04:09.039 Something's wrong here 48 00:04:12.489 --> 00:04:15.520 Include BoxComponent into Components 49 00:04:15.520 --> 00:04:20.150 So if you add like this we can set it to the root 50 00:04:20.150 --> 00:04:24.489 Now we need to build the appearance 51 00:04:24.489 --> 00:04:26.349 Let's create Mesh Component as well 52 00:04:26.350 --> 00:04:30.000 Write create DefaultSubobject 53 00:04:30.549 --> 00:04:35.119 For this, UStaticMeshComponent 54 00:04:35.119 --> 00:04:36.659 Like so 55 00:04:36.660 --> 00:04:39.510 Add TEXT here 56 00:04:40.559 --> 00:04:44.320 The reason we put TEXT here is this 57 00:04:44.320 --> 00:04:49.200 We can just put in without it 58 00:04:49.200 --> 00:04:52.000 But 59 00:04:54.850 --> 00:04:57.619 It can be a little complicated 60 00:04:57.620 --> 00:04:59.220 This TEXT is 61 00:04:59.220 --> 00:05:03.040 Let's look at it here 62 00:05:03.041 --> 00:05:05.241 TEXT is formed like this 63 00:05:05.241 --> 00:05:08.069 Like this 64 00:05:08.070 --> 00:05:12.120 WIDETEXT or UTF8TEXT it's formed like this 65 00:05:12.120 --> 00:05:15.020 So if you look here, the format 66 00:05:15.021 --> 00:05:16.921 It's very complicated right? 67 00:05:16.921 --> 00:05:21.919 Basically, the Unreal Engine uses 68 00:05:21.920 --> 00:05:24.020 Unicode format of UTF16 69 00:05:25.119 --> 00:05:28.389 But When you set up a network 70 00:05:28.390 --> 00:05:32.290 Or import or export other files 71 00:05:32.291 --> 00:05:33.941 Handling such tasks 72 00:05:34.391 --> 00:05:37.289 Is called encoding 73 00:05:37.290 --> 00:05:39.940 You need to do some encoding there 74 00:05:39.940 --> 00:05:42.480 Especially in C++ 75 00:05:42.481 --> 00:05:46.931 Encoding can often be confusing and cause some frustration 76 00:05:46.931 --> 00:05:50.021 However in Unreal Engine 77 00:05:50.021 --> 00:05:52.871 You can use this macro to use automatic features 78 00:05:52.871 --> 00:05:56.730 What this means is that 79 00:05:56.731 --> 00:06:01.081 Deciding which platform to build this on 80 00:06:01.081 --> 00:06:03.189 Or which method to make each system files 81 00:06:03.190 --> 00:06:06.190 So, when you handle such task 82 00:06:06.191 --> 00:06:09.989 You can be assisted by the text autocomplete feature 83 00:06:09.989 --> 00:06:11.770 For encoding purposes 84 00:06:11.771 --> 00:06:14.421 So this is what TEXT macro is for 85 00:06:14.421 --> 00:06:17.080 Therefore, try using text macro 86 00:06:17.081 --> 00:06:20.631 To wrap the text string as needed 87 00:06:20.631 --> 00:06:23.400 Now here, this need to be rooted as well 88 00:06:23.401 --> 00:06:27.201 Let's attach MeshComp to BoxComp 89 00:06:27.201 --> 00:06:30.700 And then SetupAttachment 90 00:06:31.101 --> 00:06:35.951 Next, you can choose between Box Component and Root Component 91 00:06:36.000 --> 00:06:39.879 Box Component will become root anyway 92 00:06:39.880 --> 00:06:43.830 So either of them have the same pointer value 93 00:06:43.830 --> 00:06:47.359 So you can handle it the either way 94 00:06:47.799 --> 00:06:50.729 We've built our gun 95 00:06:50.730 --> 00:06:52.431 Appearance needs to be adjusted also 96 00:06:52.431 --> 00:06:54.731 But we cannot quite do it just yet 97 00:06:54.731 --> 00:06:57.019 We don't know what value to put in 98 00:06:57.020 --> 00:07:00.470 For the scale and so on 99 00:07:00.519 --> 00:07:04.800 So we should look what we've got 100 00:07:04.801 --> 00:07:07.201 In the Unreal Engine before we do anything with it 101 00:07:07.201 --> 00:07:10.989 Since we made our BulletActor 102 00:07:10.990 --> 00:07:14.690 Let's make the actor into blueprint first 103 00:07:14.839 --> 00:07:20.159 Now, let's name it BP BulletActor 104 00:07:20.160 --> 00:07:22.860 We will create it in the blueprint folder 105 00:07:25.519 --> 00:07:28.970 Things are not in place because I didn't compile it 106 00:07:28.970 --> 00:07:30.620 So, let's go ahead and compile it 107 00:07:31.719 --> 00:07:35.670 Make sure you save all before compiling 108 00:07:35.671 --> 00:07:37.421 So, save it like this 109 00:07:37.720 --> 00:07:41.559 Now let's compile again 110 00:07:44.239 --> 00:07:49.270 Then you can see it working well 111 00:07:49.670 --> 00:07:53.069 This default root isn't supposed to be there 112 00:07:53.070 --> 00:07:56.119 But the setting doesn't always get applied correctly 113 00:07:56.119 --> 00:07:58.910 If this happens, just try turning it off and on again 114 00:07:58.911 --> 00:08:03.760 Sometimes even that wouldn't fix the problem 115 00:08:03.760 --> 00:08:07.779 In that case, do you see the class setting here? 116 00:08:07.780 --> 00:08:11.530 You can change the parent class here 117 00:08:11.530 --> 00:08:14.309 Or you can also find it in the File tab as well 118 00:08:14.310 --> 00:08:16.510 Reparent Blueprint is what we are looking for 119 00:08:16.560 --> 00:08:18.510 They are the same menu 120 00:08:18.609 --> 00:08:21.389 So just change the actor 121 00:08:21.390 --> 00:08:25.440 And then change it back to Bullet Actor 122 00:08:25.839 --> 00:08:30.319 You will see it working well 123 00:08:31.020 --> 00:08:35.920 Sometimes, in cases like this, it can be quite confusing 124 00:08:35.921 --> 00:08:38.070 With everything breaking apart, links being invisible and whatnot 125 00:08:38.070 --> 00:08:40.929 For example, when you chose mesh 126 00:08:40.930 --> 00:08:43.080 But details wouldn't show up 127 00:08:43.081 --> 00:08:45.781 Even with the proper settings 128 00:08:45.781 --> 00:08:49.169 In that case, blueprint must be broken 129 00:08:49.170 --> 00:08:52.120 You can try making blueprint again 130 00:08:52.121 --> 00:08:56.271 You can also change the parent and then change it back again 131 00:08:56.271 --> 00:08:58.690 So you can fix it the way you see fit 132 00:08:58.691 --> 00:09:00.941 But this method is better 133 00:09:00.942 --> 00:09:05.992 So, Let's change its parent and then change back again 134 00:09:06.440 --> 00:09:10.319 Now let's insert appearance into mesh component 135 00:09:10.669 --> 00:09:13.870 Search for cube 136 00:09:15.569 --> 00:09:19.660 Make one 1 cubic meter big 137 00:09:19.661 --> 00:09:21.061 Compile it 138 00:09:21.062 --> 00:09:27.812 And basic shape material for appearance 139 00:09:28.760 --> 00:09:32.000 And then we need to do what we've done for the blueprint 140 00:09:32.001 --> 00:09:34.501 Since the red one is the front 141 00:09:34.502 --> 00:09:36.302 Let's have it face forward 142 00:09:36.302 --> 00:09:40.579 Arrange your camera at a top view 143 00:09:40.580 --> 00:09:44.480 And then reduce the size 144 00:09:44.481 --> 00:09:46.481 0.75 and 0.25 145 00:09:46.679 --> 00:09:47.880 set it up like this 146 00:09:47.881 --> 00:09:52.530 Then resize the box to be 50x50x50 147 00:09:52.530 --> 00:09:59.399 And then multiply 0.75 and 0.25 148 00:10:01.620 --> 00:10:04.440 Now that the sizes have been set 149 00:10:04.890 --> 00:10:09.109 Let's look at what we've done in the codes 150 00:10:09.110 --> 00:10:10.710 Let's handle mesh component first 151 00:10:10.711 --> 00:10:14.311 If you look at the mesh component, for the scale of the Transform 152 00:10:14.311 --> 00:10:18.130 I set it to 0.75, 0.25, 1 so let's use that 153 00:10:18.131 --> 00:10:21.231 Here, you can right click to copy it 154 00:10:21.231 --> 00:10:26.430 So copy it, move it here 155 00:10:26.431 --> 00:10:27.731 Paste it right here 156 00:10:27.731 --> 00:10:30.431 Then it will look like this 157 00:10:30.631 --> 00:10:33.800 I'll apply the scale of these values 158 00:10:33.801 --> 00:10:36.201 To the mesh component 159 00:10:36.201 --> 00:10:41.650 If you write Setscale here 160 00:10:41.851 --> 00:10:46.601 You can see world scale or relative scale 161 00:10:46.601 --> 00:10:48.470 You can choose between the two 162 00:10:48.471 --> 00:10:51.521 Either relative 163 00:10:51.522 --> 00:10:52.522 Or the world, it doesn't matter 164 00:10:52.523 --> 00:10:56.773 Because we're not modifying the scale of the original itself 165 00:10:56.773 --> 00:10:59.990 We're only adjusting the scale that's at the highest level 166 00:10:59.990 --> 00:11:03.789 So, whether it's relative or world scale, they're essentially the same 167 00:11:03.789 --> 00:11:08.589 For now, I'll approach it with the concept of relative scale 168 00:11:09.760 --> 00:11:11.030 Finish the code like this 169 00:11:11.031 --> 00:11:14.381 Now we need to make the vector here 170 00:11:14.382 --> 00:11:17.382 FVector is what we need 171 00:11:17.383 --> 00:11:19.233 Put it in the bracket like this 172 00:11:19.233 --> 00:11:20.609 You can put the value in there 173 00:11:20.610 --> 00:11:22.360 You can just input these values as they are 174 00:11:22.361 --> 00:11:27.611 0.78 and 0.25 175 00:11:29.479 --> 00:11:32.760 Like so 176 00:11:33.760 --> 00:11:38.519 Next, if we look at the box 177 00:11:38.520 --> 00:11:42.370 We also changed the Box Extent, right? 178 00:11:42.371 --> 00:11:45.171 Let's we try copying this as well, like the 37.5 here 179 00:11:45.171 --> 00:11:47.120 Copy it 180 00:11:47.121 --> 00:11:50.871 This one is called Box Extent 181 00:11:50.872 --> 00:11:53.872 If you come here to the BoxComponent 182 00:11:54.320 --> 00:11:57.120 What I copied are gone 183 00:11:57.120 --> 00:11:59.130 Let's go back and copy the value 184 00:11:59.131 --> 00:12:01.131 Let's Paste it 185 00:12:02.960 --> 00:12:10.930 There is a function called SetBoxExtent for the box component 186 00:12:10.931 --> 00:12:14.081 We will paste the value here with FVector 187 00:12:15.359 --> 00:12:18.169 Paste it here 188 00:12:23.640 --> 00:12:29.359 So the value will be 37.5 and 12.5 then 50 189 00:12:32.709 --> 00:12:35.250 Just like so 190 00:12:35.251 --> 00:12:36.401 This is how you would handle it 191 00:12:36.402 --> 00:12:39.152 So, first, let's visually inspect it in the Blueprint 192 00:12:39.152 --> 00:12:42.319 After that, convert it to code 193 00:12:42.320 --> 00:12:45.020 This is necessary because later on 194 00:12:45.969 --> 00:12:50.070 For example, if you create an actor like this 195 00:12:50.071 --> 00:12:53.121 But imagine if I delete this 196 00:12:53.359 --> 00:12:56.690 And create it again from scratch 197 00:12:56.691 --> 00:12:59.741 Then, if you had done this operation in Blueprint 198 00:12:59.742 --> 00:13:02.992 If you made modifications to values here 199 00:13:02.992 --> 00:13:06.780 And then deleted the Blueprint and recreated it 200 00:13:06.781 --> 00:13:07.781 Those changes wouldn't be reflected 201 00:13:07.782 --> 00:13:10.182 You'd need to reapply those values again 202 00:13:10.182 --> 00:13:14.811 If you write it in the source file like this 203 00:13:14.811 --> 00:13:18.811 When you create it anew, these values will be applied immediately 204 00:13:18.811 --> 00:13:22.060 This would be more convenient, although it might be 205 00:13:22.061 --> 00:13:24.661 Therefore, writing it like this here 206 00:13:24.812 --> 00:13:27.062 Can be considered more desirable 207 00:13:27.960 --> 00:13:31.640 So that's how we handle it 208 00:13:33.719 --> 00:13:36.819 Now let's take it out 209 00:13:36.820 --> 00:13:38.670 If you do that it will look like this 210 00:13:40.119 --> 00:13:44.389 So now we need to make sure this to spawn 211 00:13:44.390 --> 00:13:46.240 We will make it spawn 212 00:13:47.240 --> 00:13:49.029 We have to do it here 213 00:13:49.030 --> 00:13:52.430 Let's complete the characteristics of the bullets first 214 00:13:52.431 --> 00:13:53.831 It will needs to be moving forward 215 00:13:53.831 --> 00:13:58.720 Then, to make the bullet actor move forward 216 00:13:58.720 --> 00:14:02.589 You can move it in the Tick function 217 00:14:02.589 --> 00:14:06.590 Write I want to move forward 218 00:14:06.590 --> 00:14:10.239 To implement the functionality 219 00:14:11.039 --> 00:14:13.300 The direction is already set 220 00:14:13.301 --> 00:14:15.851 Then we need how far 221 00:14:16.150 --> 00:14:20.550 We want to make it move 10 meters per second 222 00:14:20.551 --> 00:14:25.301 So, I will make variable called speed 223 00:14:25.301 --> 00:14:28.599 UPROPERTY 224 00:14:29.080 --> 00:14:31.559 Like this 225 00:14:38.089 --> 00:14:39.559 And then 226 00:14:40.309 --> 00:14:44.060 Write float Speed 227 00:14:44.060 --> 00:14:47.309 Give the value of 1000 for this 228 00:14:47.309 --> 00:14:50.500 So we can move it 10 meters per second 229 00:14:50.501 --> 00:14:53.901 And then, come back to Tick 230 00:14:54.000 --> 00:14:56.720 Let's actually move it 231 00:14:57.271 --> 00:14:59.871 The formula for movement is 232 00:14:59.872 --> 00:15:05.122 P equals P0 plus vt 233 00:15:05.122 --> 00:15:07.359 This formula is used very often 234 00:15:07.359 --> 00:15:09.769 So please keep in mind 235 00:15:10.170 --> 00:15:13.120 While we're at it, let me clarify this 236 00:15:13.120 --> 00:15:17.480 The formulas we often use are called physics formulas 237 00:15:17.481 --> 00:15:20.281 When we actually develop games 238 00:15:21.909 --> 00:15:23.809 The formula for motion 239 00:15:24.880 --> 00:15:28.359 This is in a way 240 00:15:29.250 --> 00:15:30.800 An uniform motion 241 00:15:30.801 --> 00:15:34.451 Uniform motion with constant velocity 242 00:15:34.452 --> 00:15:36.452 This is called Uniform motion 243 00:15:36.453 --> 00:15:39.103 Formula for motion itself is basically about uniform motion 244 00:15:39.400 --> 00:15:43.520 We also have acceleration 245 00:15:44.320 --> 00:15:45.750 Formula for acceleration 246 00:15:45.751 --> 00:15:50.901 Formula for motion is P equals P0 plus vt 247 00:15:51.101 --> 00:15:56.000 For acceleration, oh these ones should be vector 248 00:15:56.439 --> 00:15:59.420 Speed is v for velocity 249 00:15:59.421 --> 00:16:05.271 So, v equals v0 plus at 250 00:16:05.720 --> 00:16:07.609 This is the formula for acceleration 251 00:16:07.610 --> 00:16:11.410 So current velocity is current velocity plus 252 00:16:12.259 --> 00:16:16.359 Acceleration times by t 253 00:16:16.359 --> 00:16:21.159 And then we have formula for force 254 00:16:23.259 --> 00:16:28.679 so, F equals ma 255 00:16:28.679 --> 00:16:33.820 So, force is mass times acceleration 256 00:16:33.821 --> 00:16:37.271 If the value for mass is 1 257 00:16:37.272 --> 00:16:39.272 Force is acceleration itself 258 00:16:40.170 --> 00:16:42.939 So these are the formulas 259 00:16:42.940 --> 00:16:45.690 The three basic formulas we often use 260 00:16:46.489 --> 00:16:48.569 It's used a lot, knowingly or unknowingly 261 00:16:48.570 --> 00:16:51.820 Next, vectors are widely used also 262 00:16:53.239 --> 00:16:58.919 We learned about vector addition and subtraction 263 00:16:59.319 --> 00:17:02.800 Through addition, we learned how to create a vector like this 264 00:17:02.800 --> 00:17:05.450 When an object is bound by two vectors like this 265 00:17:05.450 --> 00:17:08.990 And then we learned that if we have one vector here and another vector here 266 00:17:08.991 --> 00:17:11.791 We can create a vector pointing in this direction 267 00:17:11.791 --> 00:17:16.269 By subtracting vector b from vector a, resulting in vector c 268 00:17:16.870 --> 00:17:22.170 And later on, you'll also learn about vector multiplication 269 00:17:22.319 --> 00:17:26.779 Vectors are fundamentally characterized 270 00:17:27.640 --> 00:17:29.490 By direction and magnitude 271 00:17:29.490 --> 00:17:32.140 Direction is actually vector 272 00:17:34.189 --> 00:17:38.840 So, there's vector multiplication for directions 273 00:17:38.840 --> 00:17:39.740 And then there's scalar multiplication 274 00:17:39.740 --> 00:17:42.140 Size is scalar 275 00:17:46.270 --> 00:17:50.550 So, the multiplication of directions in vectors is called 276 00:17:50.551 --> 00:17:54.601 The cross product, denoted by × and pronounced as cross 277 00:17:55.800 --> 00:17:58.280 We call this the cross product 278 00:17:58.281 --> 00:18:00.481 Also known as the outer product 279 00:18:00.932 --> 00:18:05.082 And scalar multiplication is called the dot product, represented by a dot 280 00:18:05.082 --> 00:18:10.040 So, we call it the dot product, which is also known as the inner product 281 00:18:10.041 --> 00:18:12.191 You'll use these concepts quite frequently 282 00:18:12.640 --> 00:18:15.629 Honestly, just grasping these concepts here 283 00:18:15.630 --> 00:18:18.880 It should account for 30% to 40% of the work 284 00:18:19.079 --> 00:18:23.689 So, rather than these concepts being very difficult 285 00:18:23.690 --> 00:18:25.791 Of course, they can be challenging at first like this 286 00:18:25.791 --> 00:18:29.741 Especially through concepts like vector multiplication 287 00:18:29.741 --> 00:18:33.920 You can determine magnitude and angles 288 00:18:33.921 --> 00:18:36.121 This can help you find the normal 289 00:18:36.520 --> 00:18:39.110 It's not normalize, there is something called normal 290 00:18:39.111 --> 00:18:42.261 There might be an opportunity to explain this later 291 00:18:42.512 --> 00:18:45.262 but for now, it would be good if you could remember it this way 292 00:18:46.160 --> 00:18:48.310 We're primarily focusing on 293 00:18:48.310 --> 00:18:51.900 Learning about the formula for movement among these concepts 294 00:18:51.901 --> 00:18:54.301 Let's give movement once again 295 00:18:54.301 --> 00:18:56.070 Make P0 first 296 00:18:56.071 --> 00:18:58.471 Start with FVector 297 00:18:58.472 --> 00:19:02.772 For P0 find our actor's current position 298 00:19:02.772 --> 00:19:05.900 GetActorLocation 299 00:19:08.500 --> 00:19:10.160 Get the position 300 00:19:10.511 --> 00:19:12.311 And then we will make velocity 301 00:19:12.311 --> 00:19:14.010 First, we need to determine the direction 302 00:19:14.010 --> 00:19:16.709 Write FVector dir 303 00:19:16.710 --> 00:19:18.811 So, we said the direction is forward 304 00:19:18.811 --> 00:19:22.561 So, when you use GetActor 305 00:19:22.959 --> 00:19:25.740 With FVector like this 306 00:19:25.741 --> 00:19:30.291 If it's the front, it's 1, 0, 0 307 00:19:31.190 --> 00:19:34.900 But doing it this way means it's always in an absolute direction 308 00:19:34.901 --> 00:19:38.301 Instead of that, for the relative forward direction 309 00:19:38.650 --> 00:19:42.169 We use GetActorForwardVector 310 00:19:42.170 --> 00:19:44.870 Then it means my front 311 00:19:44.871 --> 00:19:46.756 Current actor's, my front side 312 00:19:46.756 --> 00:19:50.119 Like so 313 00:19:50.359 --> 00:19:55.809 And if you create a velocity in FVector here 314 00:19:55.810 --> 00:19:56.810 Write V 315 00:19:56.959 --> 00:20:00.839 And dir speed 316 00:20:02.989 --> 00:20:05.300 So now, we can combine these 317 00:20:05.301 --> 00:20:08.401 SetActorLocation 318 00:20:09.000 --> 00:20:16.040 P0 plus v times DeltaTime 319 00:20:17.839 --> 00:20:20.260 Now, it will go to the front side 320 00:20:20.261 --> 00:20:21.711 Save now 321 00:20:21.711 --> 00:20:25.862 You can use Ctrl Alt F11 for shorcut 322 00:20:26.310 --> 00:20:30.439 These shortcuts were designed without considering Korean users 323 00:20:30.439 --> 00:20:32.990 So in Korea, this shortcut appear differently 324 00:20:33.239 --> 00:20:35.569 So, it's a bit inconvenient, but 325 00:20:35.570 --> 00:20:37.470 Anyway, it ends up like this 326 00:20:38.910 --> 00:20:40.800 So, you can just press this 327 00:20:40.801 --> 00:20:42.351 If you look here 328 00:20:42.352 --> 00:20:45.052 The shortcuts with their names are written at the top like this 329 00:20:45.800 --> 00:20:48.419 It's okay to press like this 330 00:20:48.420 --> 00:20:51.070 Sure, let's try arranging it 331 00:20:51.071 --> 00:20:53.671 So, arrange it like this and rotate it like so 332 00:20:54.160 --> 00:20:56.490 Let's see if it goes forward now 333 00:20:56.491 --> 00:20:58.591 It goes up like this 334 00:20:59.240 --> 00:21:02.689 If you look here, it's upwards like this, with the color red 335 00:21:02.690 --> 00:21:04.640 You can see it going up 336 00:21:04.640 --> 00:21:07.090 Now let's proceed to creating bullets 337 00:21:07.090 --> 00:21:08.550 Not this 338 00:21:10.200 --> 00:21:14.800 Now we need to proceed to creating bullets 339 00:21:15.719 --> 00:21:19.959 To do that, let's go to the player 340 00:21:24.560 --> 00:21:28.599 What I want to do here is this 341 00:21:31.920 --> 00:21:37.969 If you press left mouse button 342 00:21:37.969 --> 00:21:45.880 Write I want to spawn a bullet actor in the level 343 00:21:47.780 --> 00:21:50.430 But we want to spawn them in a certain place 344 00:21:50.431 --> 00:21:51.931 We want to Spawn 345 00:21:54.231 --> 00:21:56.739 Write arrow 346 00:21:56.740 --> 00:21:59.140 We've made this arrow thing last time 347 00:21:59.239 --> 00:22:02.790 This arrow is at where ArrowComponent is 348 00:22:02.791 --> 00:22:05.841 We want to use 349 00:22:06.190 --> 00:22:12.960 Transform of the ArrowComponent 350 00:22:13.800 --> 00:22:17.890 First we need to receive input 351 00:22:17.891 --> 00:22:20.691 After that, we should be able to create it like this 352 00:22:20.691 --> 00:22:21.719 Let's try 353 00:22:21.720 --> 00:22:23.520 To recieve input 354 00:22:23.521 --> 00:22:26.371 We've created a function like this 355 00:22:26.371 --> 00:22:27.840 We've created the method 356 00:22:27.841 --> 00:22:30.640 Just like that let's make one as void type 357 00:22:30.640 --> 00:22:34.319 Write on and we will use action not axis 358 00:22:34.319 --> 00:22:38.640 Let's wrap this one first 359 00:22:38.760 --> 00:22:42.359 From Project Settings input 360 00:22:42.360 --> 00:22:44.710 Let's add action mappings 361 00:22:44.959 --> 00:22:47.950 I want to call it the Fire 362 00:22:49.199 --> 00:22:52.150 And we'll handle the button as the left mouse button like this 363 00:22:52.151 --> 00:22:54.701 We just made an action 364 00:22:55.001 --> 00:22:58.760 called the Fire action 365 00:22:58.761 --> 00:23:04.061 So let's name it OnActionFire 366 00:23:04.160 --> 00:23:06.099 And now we need to implement the function 367 00:23:06.100 --> 00:23:10.050 Press Alt Enter to implement the function 368 00:23:11.550 --> 00:23:17.160 Let's create another function 369 00:23:17.160 --> 00:23:20.130 That performs the action of making bullets when I press this Fire button 370 00:23:20.131 --> 00:23:22.181 I'll call that function to create the bullets 371 00:23:22.280 --> 00:23:30.359 I'll create a function like this, void MakeBullet 372 00:23:30.359 --> 00:23:33.839 Create the implementation for this as awell 373 00:23:37.610 --> 00:23:41.880 Now let's go this way, ActionFire 374 00:23:41.880 --> 00:23:45.909 Now we need to register it 375 00:23:46.360 --> 00:23:49.910 Register the function to this input 376 00:23:50.010 --> 00:23:51.529 These ones 377 00:23:51.530 --> 00:23:55.880 As before, you can use the BindAction function 378 00:23:56.079 --> 00:24:00.700 In PlayerInputComponent for this 379 00:24:00.701 --> 00:24:03.551 If you look at the contents here 380 00:24:03.551 --> 00:24:04.810 You put name into the action 381 00:24:04.811 --> 00:24:07.361 And then which key was pressed 382 00:24:07.362 --> 00:24:09.362 What kind of action it is 383 00:24:09.363 --> 00:24:11.963 What kind of event it is 384 00:24:11.964 --> 00:24:14.514 And then the user class 385 00:24:14.514 --> 00:24:16.280 We use This for this 386 00:24:16.281 --> 00:24:17.631 And finally 387 00:24:17.632 --> 00:24:19.034 It's out of the screen 388 00:24:19.680 --> 00:24:22.060 This is it 389 00:24:25.010 --> 00:24:28.360 So if you look at the third box 390 00:24:28.360 --> 00:24:29.261 Let's reduce the size 391 00:24:29.262 --> 00:24:31.662 If you look here, we need Ptr for the method 392 00:24:31.662 --> 00:24:33.819 And then the pointer 393 00:24:33.820 --> 00:24:36.520 Alright, so I'll write it like this 394 00:24:36.521 --> 00:24:38.171 TEXT 395 00:24:42.239 --> 00:24:44.610 Earlier, we mentioned Fire 396 00:24:44.610 --> 00:24:47.261 So the name we put in here 397 00:24:47.262 --> 00:24:49.412 Is the name we used there 398 00:24:49.760 --> 00:24:52.589 Write it like this 399 00:24:52.590 --> 00:24:56.240 Write Fire 400 00:24:56.240 --> 00:25:01.469 The second part asks what action was taken 401 00:25:01.470 --> 00:25:03.220 And here we can see there are basically three main options 402 00:25:03.221 --> 00:25:07.571 One is whether it was pressed, released, or held down 403 00:25:07.571 --> 00:25:09.920 Repeat means doing the action over again 404 00:25:09.921 --> 00:25:13.171 Alright, we can categorize it as press, release, and so on 405 00:25:13.171 --> 00:25:16.639 I will do this wen pressed 406 00:25:16.640 --> 00:25:19.890 And then this and name of the function goes in 407 00:25:19.890 --> 00:25:21.439 Like this 408 00:25:21.740 --> 00:25:25.540 When we add this, always use & 409 00:25:26.491 --> 00:25:30.641 To give away the function's address 410 00:25:31.439 --> 00:25:33.479 So if we do this, it will become the call 411 00:25:33.480 --> 00:25:34.480 Now it's connect 412 00:25:34.481 --> 00:25:37.131 The concept is that 413 00:25:37.132 --> 00:25:40.932 When I press the button, this function is called 414 00:25:45.530 --> 00:25:49.239 Now let's go down a bit 415 00:25:51.959 --> 00:25:54.910 Here we need to use Spawn 416 00:25:54.911 --> 00:25:59.161 For Spawn we can use a function called getWorld 417 00:25:59.161 --> 00:26:04.900 Look at world, you will find SpawnActor 418 00:26:05.301 --> 00:26:08.351 Do you remember that when we did blueprint 419 00:26:08.400 --> 00:26:09.680 We did this 420 00:26:09.681 --> 00:26:13.581 Here, Spawn, Actor of Class 421 00:26:16.439 --> 00:26:19.109 You remember using node like this? 422 00:26:19.110 --> 00:26:21.710 You can consider these to be the same 423 00:26:21.959 --> 00:26:24.390 Now, if you come here 424 00:26:24.391 --> 00:26:26.291 You can use a function called SpawnActor 425 00:26:26.291 --> 00:26:30.191 To create bullets we so desire 426 00:26:30.192 --> 00:26:33.192 Then, here 427 00:26:33.192 --> 00:26:36.900 This is built generically using a template 428 00:26:36.901 --> 00:26:39.151 So add the pointed parentheses 429 00:26:39.152 --> 00:26:42.002 Add ABulletActor here 430 00:26:42.880 --> 00:26:46.480 Add that you are going to make BulletActor like this 431 00:26:46.481 --> 00:26:48.831 And then what actually goes in here is 432 00:26:49.530 --> 00:26:51.830 UClass 433 00:26:52.381 --> 00:26:55.881 You've probably seen User class but UClass will be new 434 00:26:55.981 --> 00:27:01.839 For UClass, think about what I said 435 00:27:04.939 --> 00:27:07.839 If you take a look at this Uclass 436 00:27:08.739 --> 00:27:13.090 When the Header tool executes 437 00:27:13.091 --> 00:27:15.741 It analyses these actors 438 00:27:15.741 --> 00:27:18.042 To make something called UClass 439 00:27:18.042 --> 00:27:22.180 It means ultimately, Uclass is 440 00:27:22.181 --> 00:27:24.131 Some kind of similar to actors 441 00:27:24.132 --> 00:27:26.782 Actor, pawn characters for example 442 00:27:26.782 --> 00:27:31.329 So, ones that we can create to utilize 443 00:27:31.330 --> 00:27:36.530 So here it says such codes must be in here 444 00:27:36.530 --> 00:27:39.900 So let's create an UClass here 445 00:27:39.901 --> 00:27:41.601 Go to Player pawn header 446 00:27:42.400 --> 00:27:44.830 Now to make a bullet actor 447 00:27:44.831 --> 00:27:49.781 We need some kind of entity for the actor 448 00:27:49.782 --> 00:27:53.182 Now we will make a documentation to contain the entity 449 00:27:53.280 --> 00:27:57.839 Write UPROPERTY 450 00:27:59.199 --> 00:28:02.400 Write EditAnywhere 451 00:28:02.959 --> 00:28:04.250 Write down like this 452 00:28:04.251 --> 00:28:07.051 And then let's start with UClass here 453 00:28:08.000 --> 00:28:12.479 UClass pointer 454 00:28:14.380 --> 00:28:16.120 Use the line trace 455 00:28:16.121 --> 00:28:19.571 Let's name it the bullet Factory here 456 00:28:20.599 --> 00:28:24.309 Like how bullets are made one by one in the factory 457 00:28:24.310 --> 00:28:28.110 That's why I use the name bulletFactory 458 00:28:29.859 --> 00:28:31.790 The reason why I say that is because 459 00:28:31.791 --> 00:28:35.191 What do we need to do to make an item in the factory? 460 00:28:35.192 --> 00:28:36.192 We call 461 00:28:36.193 --> 00:28:38.643 Please send me a bullet 462 00:28:38.644 --> 00:28:42.144 Then the worker will get up 463 00:28:42.144 --> 00:28:44.750 And go to the factory to make a bullet 464 00:28:44.751 --> 00:28:47.251 And then carry it in a car 465 00:28:47.252 --> 00:28:49.352 To deliver the product 466 00:28:51.400 --> 00:28:56.139 That means actual file input output operations will happen 467 00:28:56.140 --> 00:28:59.440 Even if we just create it and use it directly 468 00:28:59.441 --> 00:29:01.441 Actually reading a file 469 00:29:01.839 --> 00:29:05.160 Loading it into memory 470 00:29:05.161 --> 00:29:07.711 And using it is the core concept 471 00:29:07.712 --> 00:29:09.262 So you need some time 472 00:29:09.262 --> 00:29:12.739 So that's why I am using a term called factory 473 00:29:12.740 --> 00:29:15.340 So for now we will use UClass Factory for the name 474 00:29:15.340 --> 00:29:19.759 Then, after loading it into memory, you can proceed to write it like this here 475 00:29:19.760 --> 00:29:22.360 I created a factory and arranged it like this 476 00:29:22.360 --> 00:29:27.770 Then, the second parameter should be passed 477 00:29:27.771 --> 00:29:30.571 As either transform or 1 of 7 478 00:29:30.571 --> 00:29:35.219 So, this means there are now seven overloaded versions of this 479 00:29:35.220 --> 00:29:39.770 So, this means there are seven versions of the SpawnActor function 480 00:29:39.770 --> 00:29:44.000 Now, try pressing the down arrow key on your keyboard 481 00:29:44.001 --> 00:29:47.851 The parameters look a bit different in this way 482 00:29:47.851 --> 00:29:51.980 It seems like we can just use the transform here 483 00:29:51.981 --> 00:29:54.681 We've decided to use arrow 484 00:29:54.681 --> 00:29:57.560 To Arrow 485 00:29:58.560 --> 00:30:03.680 Bring GetTransform 486 00:30:05.569 --> 00:30:07.839 If you take a look, there are several things 487 00:30:07.839 --> 00:30:10.480 We want to use the world coordinate system 488 00:30:10.481 --> 00:30:12.031 But there isn't world written here 489 00:30:12.032 --> 00:30:13.932 We have relative or socket 490 00:30:13.932 --> 00:30:15.549 There is only component 491 00:30:15.550 --> 00:30:17.450 This component is the world 492 00:30:17.451 --> 00:30:20.851 One thing that's a bit disappointing is that the names 493 00:30:20.901 --> 00:30:23.249 In the blueprint and the names here in C++ are a bit different 494 00:30:23.250 --> 00:30:25.450 Some of them are different little by little 495 00:30:25.451 --> 00:30:27.251 So, be careful for that case 496 00:30:27.251 --> 00:30:30.109 When we talk of GetComponentTransform 497 00:30:30.110 --> 00:30:33.060 It indicates the world coordinates of this arrow component 498 00:30:33.060 --> 00:30:37.560 This is how we obtain the transform in the world coordinate system 499 00:30:37.560 --> 00:30:38.909 That's that 500 00:30:38.910 --> 00:30:40.660 The reason error occurs is 501 00:30:40.661 --> 00:30:42.861 Because we haven't included the header 502 00:30:42.862 --> 00:30:46.062 It's not recognizing UClass right now 503 00:30:46.062 --> 00:30:48.109 So let's just add the header 504 00:30:48.110 --> 00:30:50.510 Include it like this 505 00:30:51.359 --> 00:30:56.079 Let me go ahead and add it like this 506 00:30:58.079 --> 00:31:03.040 You can just write it like this 507 00:31:06.560 --> 00:31:09.359 Works well right? 508 00:31:10.689 --> 00:31:12.539 I think I placed it incorrectly 509 00:31:12.539 --> 00:31:14.790 This one should go here 510 00:31:14.791 --> 00:31:17.841 Calling the MakeBullet here should be better 511 00:31:19.239 --> 00:31:20.510 The reason I did it like this is because 512 00:31:20.511 --> 00:31:23.511 When I have some time 513 00:31:23.512 --> 00:31:26.112 I wanted to try shooting automatically 514 00:31:26.113 --> 00:31:29.413 So I separated MakeBullet like this 515 00:31:29.413 --> 00:31:32.280 That's that 516 00:31:32.439 --> 00:31:34.880 Next 517 00:31:35.280 --> 00:31:37.919 We need the gun to shoot 518 00:31:37.920 --> 00:31:41.320 let's go ahead in this direction and compile it 519 00:31:41.320 --> 00:31:43.220 Save all 520 00:31:43.570 --> 00:31:45.920 Compile it 521 00:31:51.289 --> 00:31:53.119 Come to player 522 00:31:53.120 --> 00:31:56.220 And look at Class Default 523 00:31:56.221 --> 00:31:58.421 The Bullet Factory is empty 524 00:31:58.421 --> 00:32:01.969 So right here 525 00:32:01.970 --> 00:32:06.420 We want to place 526 00:32:06.421 --> 00:32:07.821 The blueprint, BP BulletActor 527 00:32:07.821 --> 00:32:10.040 And then if you open it 528 00:32:10.041 --> 00:32:13.541 I only want to put the bullet in but there are so many other things 529 00:32:13.542 --> 00:32:15.092 There are way too many stuff 530 00:32:15.092 --> 00:32:18.949 These are all classes that inherit from UClass 531 00:32:18.950 --> 00:32:21.300 Even Actors inherit from UClass 532 00:32:21.300 --> 00:32:24.170 Because it's set up like this, it can be a bit difficult to find 533 00:32:24.171 --> 00:32:25.821 You can just write it down 534 00:32:25.822 --> 00:32:30.022 if you look, you will find BP BulletActor 535 00:32:30.022 --> 00:32:31.859 You can insert like this 536 00:32:31.860 --> 00:32:34.210 If you keep doing it like this every time 537 00:32:34.211 --> 00:32:37.211 It will be very inconvenient for maintenance in the future 538 00:32:37.359 --> 00:32:39.919 Because there's a risk of something incorrect getting inserted 539 00:32:39.920 --> 00:32:44.020 So, it seems like it would be good to improve this a little 540 00:32:45.419 --> 00:32:49.110 if you look here, I'll quickly switch to the header 541 00:32:49.111 --> 00:32:51.211 I wrote UClass 542 00:32:51.212 --> 00:32:54.312 So, we do this instead 543 00:32:54.312 --> 00:32:57.680 Change the factory 544 00:32:57.681 --> 00:33:02.031 We have a function called TSubclassOF 545 00:33:02.032 --> 00:33:03.775 This is also a kind of class 546 00:33:03.930 --> 00:33:07.810 So it's formed as a template 547 00:33:08.760 --> 00:33:13.810 Here we write ABulletActor like this 548 00:33:13.811 --> 00:33:16.811 Now, we need to make a forward declaration this as well 549 00:33:17.560 --> 00:33:23.920 Writing like this gives an advantage 550 00:33:23.920 --> 00:33:27.089 Where containing BulletFactory in the variables 551 00:33:27.090 --> 00:33:31.190 Will be limited to ones less than 552 00:33:31.191 --> 00:33:33.891 Ones that inherit ABulletActor 553 00:33:34.239 --> 00:33:37.389 In a way it is restricting data types 554 00:33:37.390 --> 00:33:40.890 So if you don't put in right, errors occur 555 00:33:41.439 --> 00:33:45.080 And moreover, the classes that go in here 556 00:33:45.081 --> 00:33:49.881 Are only classes inheriting from ABulletActor UClass can be entered here 557 00:33:49.881 --> 00:33:51.519 Otherwise, you will get an error 558 00:33:51.520 --> 00:33:53.620 It's the compile error 559 00:33:53.621 --> 00:33:57.521 So it let us use strict data types 560 00:33:57.522 --> 00:34:02.472 As they enforce a more rigorous structure 561 00:34:02.472 --> 00:34:05.839 So let's do this and see what changes 562 00:34:05.839 --> 00:34:09.129 Do this and save again 563 00:34:09.130 --> 00:34:11.330 After compiling 564 00:34:16.679 --> 00:34:19.700 Now, back in the player, when you open this 565 00:34:19.701 --> 00:34:23.001 You'll see that it displays 566 00:34:23.002 --> 00:34:25.052 BulletActor itself 567 00:34:25.052 --> 00:34:27.480 Or any blueprint class derived from it 568 00:34:27.481 --> 00:34:30.181 Only these two options are displayed 569 00:34:30.182 --> 00:34:33.080 Here, we'll be using the blueprint class 570 00:34:34.680 --> 00:34:38.099 let's do this, compile, and then run it 571 00:34:38.100 --> 00:34:43.650 Now we can see that pressing the button fires the bullet 572 00:34:45.650 --> 00:34:48.300 Handling the bullet firing sound 573 00:34:49.600 --> 00:34:52.520 Let's add the sound here 574 00:34:52.521 --> 00:34:56.221 We've tried playing sounds before in our last session 575 00:34:56.221 --> 00:34:59.729 Let's try this out with the Star Wars blaster sound 576 00:34:59.730 --> 00:35:02.430 Alright, let's create a folder here 577 00:35:02.431 --> 00:35:04.781 And make a Sound folder 578 00:35:08.080 --> 00:35:10.479 Like so 579 00:35:10.679 --> 00:35:12.759 In the sound folder 580 00:35:12.760 --> 00:35:15.060 Later on, it would be good to add an explosion sound as well 581 00:35:15.061 --> 00:35:17.211 So let's include that together 582 00:35:17.211 --> 00:35:20.260 Let's add these and save 583 00:35:22.710 --> 00:35:30.109 And now, back in the player class 584 00:35:30.110 --> 00:35:32.309 We need to play the sound here 585 00:35:32.309 --> 00:35:36.549 Playing the sound when MakeBullet is called would work well 586 00:35:36.550 --> 00:35:39.650 We could just write the code here 587 00:35:39.650 --> 00:35:42.820 But to recall our memory 588 00:35:42.821 --> 00:35:49.421 Remember when we make sound 589 00:35:49.520 --> 00:35:51.930 We used a node named Play Sound 2d? 590 00:35:51.931 --> 00:35:54.132 Here, we also added the sound Bullet like this before 591 00:35:54.132 --> 00:35:57.780 And you can see it labeled as SoundBase here 592 00:35:57.780 --> 00:36:01.169 So, we should use the same data type as this one 593 00:36:01.169 --> 00:36:05.120 When wondering how to use the function for playing sounds 594 00:36:05.121 --> 00:36:06.871 There's no need to worry 595 00:36:06.872 --> 00:36:10.072 Most of you have done blueprint first 596 00:36:10.120 --> 00:36:13.529 Of course, once you're familiar with it 597 00:36:13.530 --> 00:36:15.530 You can work directly in C++ without needing to use blueprints 598 00:36:15.530 --> 00:36:18.190 If you worked with a blueprint first 599 00:36:18.191 --> 00:36:19.191 It would be easier 600 00:36:19.192 --> 00:36:20.192 Let me show you 601 00:36:20.193 --> 00:36:21.893 If you double click on it 602 00:36:21.893 --> 00:36:25.840 Like this, Reading C++ Symbol shows up 603 00:36:25.841 --> 00:36:28.241 Right here if you look at output log here 604 00:36:28.242 --> 00:36:32.992 The node specifies which function it calls 605 00:36:32.992 --> 00:36:36.199 It looks like it's the Play Sound 2D 606 00:36:37.249 --> 00:36:39.970 Function from UGameplayStatics 607 00:36:39.971 --> 00:36:42.371 You can use this function 608 00:36:42.371 --> 00:36:44.659 Copy as it is 609 00:36:44.660 --> 00:36:47.460 Move over here to the MakeBullet function 610 00:36:48.159 --> 00:36:50.109 After Spawning bullets 611 00:36:50.109 --> 00:36:52.830 After this we will proceed 612 00:36:52.831 --> 00:36:53.981 To use it here 613 00:36:53.981 --> 00:36:56.030 This UGameplayStatics 614 00:36:56.030 --> 00:36:59.739 Require a new header to be included 615 00:36:59.740 --> 00:37:01.590 Like this, include it 616 00:37:03.000 --> 00:37:05.940 So, add the header like this 617 00:37:05.941 --> 00:37:09.291 But now there is some kind of an error 618 00:37:09.292 --> 00:37:10.892 It shouldn't be like this 619 00:37:10.892 --> 00:37:13.393 Let's search for this 620 00:37:13.393 --> 00:37:16.120 Like this 621 00:37:17.560 --> 00:37:21.990 If you search here 622 00:37:22.491 --> 00:37:27.241 There's a fold in front of kismet when including 623 00:37:27.241 --> 00:37:28.920 You need this added 624 00:37:28.921 --> 00:37:31.722 Bring it over here 625 00:37:31.722 --> 00:37:33.322 Write it here like this 626 00:37:36.659 --> 00:37:40.280 After you write it like this, there shouldn't be any errors 627 00:37:40.280 --> 00:37:41.330 Now we are good to go 628 00:37:41.331 --> 00:37:44.031 If you add bracket here 629 00:37:44.032 --> 00:37:47.382 Since it's a function, the first variable 630 00:37:48.232 --> 00:37:50.669 Will be WorldContextObject 631 00:37:50.670 --> 00:37:54.320 And secondly, USoundBase goes in 632 00:37:54.669 --> 00:37:56.610 World is simple 633 00:37:56.611 --> 00:37:58.361 All you need is to do a GetWorld 634 00:37:59.112 --> 00:38:01.562 After that, the sound should be included 635 00:38:01.562 --> 00:38:03.699 There should be some kind of sound after that 636 00:38:03.700 --> 00:38:05.550 Then we need to make it a variable 637 00:38:05.551 --> 00:38:08.251 And fill it in the Unreal Engine, in order to use it 638 00:38:08.251 --> 00:38:11.110 Since this is the Fire sound 639 00:38:11.111 --> 00:38:13.161 Let's make it here 640 00:38:13.162 --> 00:38:15.062 Let's write it down first 641 00:38:15.062 --> 00:38:19.170 We will make something called FireSound 642 00:38:19.171 --> 00:38:22.071 So, let's declare the variable 643 00:38:23.120 --> 00:38:26.879 Go to header file 644 00:38:28.690 --> 00:38:31.520 UPROPERTY 645 00:38:31.520 --> 00:38:35.250 EditAnywhere 646 00:38:35.251 --> 00:38:37.352 And earlier, it was SoundBase 647 00:38:37.352 --> 00:38:44.129 Write class and then USoundBase 648 00:38:44.320 --> 00:38:48.470 With the pointer, write FireSound 649 00:38:54.020 --> 00:38:58.159 Now save all 650 00:38:59.000 --> 00:39:02.360 And then compile it once again 651 00:39:03.959 --> 00:39:08.760 This live coding isn't very stable 652 00:39:08.761 --> 00:39:12.511 Think of it as being in a preliminary service state 653 00:39:12.511 --> 00:39:15.660 So, when your work is fine but keep having errors 654 00:39:15.661 --> 00:39:18.011 Don't get confused and just turn it off and on again 655 00:39:18.012 --> 00:39:20.662 When you restart like this 656 00:39:20.663 --> 00:39:23.663 You should run it from within Visual Studio 657 00:39:23.663 --> 00:39:25.989 Here, you see there's a button 658 00:39:25.990 --> 00:39:29.140 Start without debugging or after debugging 659 00:39:29.141 --> 00:39:31.491 There are two options, but typically you should use this one 660 00:39:31.491 --> 00:39:34.689 If you press it like this, it will start 661 00:39:34.690 --> 00:39:37.440 The shortcut key is Ctrl F5 662 00:39:37.440 --> 00:39:41.339 If you look, it's right here under Debug 663 00:39:41.339 --> 00:39:42.589 Ctrl F5 664 00:39:42.589 --> 00:39:45.390 You can see it starting again 665 00:39:46.679 --> 00:39:47.979 After this 666 00:39:48.479 --> 00:39:50.999 And to the player 667 00:39:51.000 --> 00:39:54.250 I'll also connect that audio file too 668 00:39:54.250 --> 00:39:56.929 If you look here, the Fire Sound is missing 669 00:39:56.930 --> 00:39:58.630 Open it up 670 00:40:02.600 --> 00:40:05.430 Add it back in 671 00:40:06.760 --> 00:40:13.479 Compile it and run to see the sound working well 672 00:40:16.800 --> 00:40:18.650 If you run it 673 00:40:18.650 --> 00:40:21.720 You can see the sound working well 674 00:40:21.721 --> 00:40:23.071 It's a bit loud 675 00:40:23.120 --> 00:40:25.750 If you don't like how loud it is 676 00:40:25.751 --> 00:40:26.901 Like we did before 677 00:40:26.901 --> 00:40:31.402 You can reduce the sound volume independently 678 00:40:43.780 --> 00:40:45.930 Like so 679 00:40:46.731 --> 00:40:49.981 We can just set it like this but 680 00:40:50.280 --> 00:40:55.030 When we fire 681 00:40:55.031 --> 00:40:57.781 Clicking it for each shot is too much work 682 00:40:57.782 --> 00:41:01.232 So, let's try improving this 683 00:41:01.320 --> 00:41:05.520 Back to the player 684 00:41:06.520 --> 00:41:10.199 This time, additionally 685 00:41:15.299 --> 00:41:21.399 When the left mouse button is held down 686 00:41:21.399 --> 00:41:25.399 Bullets fire 687 00:41:25.600 --> 00:41:27.959 When released 688 00:41:28.719 --> 00:41:32.120 Stop shooting 689 00:41:33.479 --> 00:41:34.750 Does it make sense? 690 00:41:34.751 --> 00:41:40.101 Anyway, holding it fires the bullet and otherwise stop firing 691 00:41:40.600 --> 00:41:45.650 But holding it down might fire bullets unrealistically 692 00:41:45.651 --> 00:41:50.101 So, I'd like to create intervals where each shot is fired every 0.2 seconds 693 00:41:50.101 --> 00:41:52.380 We want the intervals 694 00:41:52.381 --> 00:41:54.031 When firing 695 00:41:57.360 --> 00:42:03.720 I want it to shoot every 0.2 second 696 00:42:03.720 --> 00:42:05.280 Like so 697 00:42:05.280 --> 00:42:08.360 To improve this 698 00:42:08.361 --> 00:42:12.211 If you look, there's only a fire action when you press the button 699 00:42:12.212 --> 00:42:14.062 So, I'll improve this function 700 00:42:14.063 --> 00:42:15.863 I'll also try renaming it 701 00:42:15.863 --> 00:42:19.369 It's better to change the name all at once 702 00:42:19.370 --> 00:42:22.920 Here, if you look at quick task refactoring 703 00:42:22.920 --> 00:42:24.739 Not this one 704 00:42:24.740 --> 00:42:27.140 Here's some thing you can use to change names 705 00:42:27.141 --> 00:42:30.341 This one I am using this, so I'll turn it off 706 00:42:30.342 --> 00:42:34.542 If you press Ctrl and R twice 707 00:42:34.542 --> 00:42:39.150 You can change name of the function in the entire project 708 00:42:39.151 --> 00:42:44.151 So let's change the name into Pressed 709 00:42:46.320 --> 00:42:48.239 Preview it 710 00:42:48.240 --> 00:42:51.740 And then apply it 711 00:42:51.741 --> 00:42:55.241 Then it says that it has been changed in three places below 712 00:42:55.439 --> 00:42:59.599 Must be declaration, implementation, and then where it connects 713 00:42:59.600 --> 00:43:01.300 So since we changed it 714 00:43:01.301 --> 00:43:04.351 Let's make one more of this 715 00:43:04.351 --> 00:43:07.639 And name it Released 716 00:43:07.639 --> 00:43:10.879 Released, like so 717 00:43:12.379 --> 00:43:15.840 Write it here 718 00:43:15.841 --> 00:43:18.541 Improvement 719 00:43:19.479 --> 00:43:22.299 Make one named Fire Released 720 00:43:22.300 --> 00:43:25.200 I should implement this too, I'll press Alt and Enter 721 00:43:25.399 --> 00:43:30.120 To create the implementation part for you 722 00:43:31.199 --> 00:43:34.330 Then, we also need to connect it 723 00:43:34.330 --> 00:43:38.181 So for now, save it and move to source file 724 00:43:38.181 --> 00:43:42.719 We also have Released function built here 725 00:43:42.720 --> 00:43:44.470 Go up now 726 00:43:44.719 --> 00:43:46.620 Connect it like this 727 00:43:46.621 --> 00:43:49.371 Copy this entire function of Fire 728 00:43:50.422 --> 00:43:52.522 Its name has been changed to Pressed 729 00:43:52.522 --> 00:43:57.559 This second one, copied as it was 730 00:43:57.560 --> 00:43:59.510 We ant to change from Pressed 731 00:43:59.959 --> 00:44:03.850 If you press Ctrl Space Bar here 732 00:44:03.851 --> 00:44:08.801 You can find the auto complete function like this 733 00:44:09.000 --> 00:44:11.049 Intelligent it's called 734 00:44:11.050 --> 00:44:14.900 So, I'm going to try using IE Released here 735 00:44:14.901 --> 00:44:16.251 Buttons are the same 736 00:44:16.251 --> 00:44:18.240 With the same action 737 00:44:18.241 --> 00:44:21.193 Same action in the game but different behavior 738 00:44:21.194 --> 00:44:22.994 So it can be like this 739 00:44:23.040 --> 00:44:26.129 So, Pressed and Released, we can handle it separately 740 00:44:26.130 --> 00:44:31.330 So then, we need to change the function, Released 741 00:44:33.529 --> 00:44:36.970 Top is Pressed bottom is Released 742 00:44:36.971 --> 00:44:37.971 Change in that order 743 00:44:39.320 --> 00:44:41.719 Like so 744 00:44:42.120 --> 00:44:45.840 We've done it 745 00:44:45.840 --> 00:44:47.389 We've made two of them 746 00:44:47.390 --> 00:44:52.840 Anyway, now we shouldn't create MakeBullet directly when performing an action 747 00:44:52.841 --> 00:44:55.391 We shouldn't do this here anymore 748 00:44:55.391 --> 00:44:57.219 What we need to do here is 749 00:44:57.220 --> 00:44:59.120 What happens now is 750 00:44:59.121 --> 00:45:04.077 I want to activate the shooting functionality for the gun 751 00:45:04.919 --> 00:45:06.570 Should be a concept like this 752 00:45:06.571 --> 00:45:08.721 Deactivate this one 753 00:45:11.570 --> 00:45:13.610 So shoot the gun is now 754 00:45:13.611 --> 00:45:15.261 Will not be activated right when I pressed 755 00:45:15.262 --> 00:45:17.162 After pressing it 756 00:45:17.163 --> 00:45:19.413 We can let it make one some time after 757 00:45:19.413 --> 00:45:23.970 And then make it stop producing when released 758 00:45:23.971 --> 00:45:29.421 So we want to approach it with the concept of activation and deactivation 759 00:45:29.421 --> 00:45:31.421 And the act of making the bullet itself is 760 00:45:31.421 --> 00:45:33.559 The MakeBullet action 761 00:45:33.560 --> 00:45:38.110 Needs to go through Tick operation 762 00:45:38.959 --> 00:45:42.089 Let's change something here 763 00:45:42.090 --> 00:45:44.890 This here is the movement part 764 00:45:45.239 --> 00:45:48.189 And MakeBullet must be done there 765 00:45:48.190 --> 00:45:49.890 To implement this 766 00:45:49.891 --> 00:45:52.491 We will need more attributes 767 00:45:52.639 --> 00:45:57.320 As time passes 768 00:45:57.560 --> 00:46:00.600 And reaches certain time 769 00:46:01.199 --> 00:46:04.840 I want it to make another bullet 770 00:46:04.841 --> 00:46:07.441 Should be processed in Tick 771 00:46:08.040 --> 00:46:10.330 And this one here itself 772 00:46:10.331 --> 00:46:17.431 When shooting functionality is activated 773 00:46:17.431 --> 00:46:20.360 Is the requirement 774 00:46:20.361 --> 00:46:23.410 I'll list the attributes needed to implement this 775 00:46:23.410 --> 00:46:29.389 Firstly, we need the concept of a switch that toggles whether the function is turned on or off 776 00:46:29.390 --> 00:46:31.390 Let's create one as a boolean type 777 00:46:31.391 --> 00:46:35.891 And then bAutoFire 778 00:46:38.560 --> 00:46:43.350 If it's True, take the action and For false, doesn't take any actions 779 00:46:43.351 --> 00:46:45.351 And then the time must flow 780 00:46:45.351 --> 00:46:46.652 Then we need current time 781 00:46:46.653 --> 00:46:49.303 The current time will keep increasing 782 00:46:49.303 --> 00:46:52.439 If the desired time has arrived, that's the concept 783 00:46:52.440 --> 00:46:54.340 In a way, it's similar to clapping 784 00:46:54.340 --> 00:46:58.760 Like so 785 00:46:58.760 --> 00:47:01.699 We use float type for time 786 00:47:01.700 --> 00:47:03.800 Therefore, make a varible 787 00:47:04.879 --> 00:47:06.890 called CurrentTime 788 00:47:06.890 --> 00:47:11.190 And them, another variable called float FireTime 789 00:47:11.191 --> 00:47:14.791 I will set the FireTime as 0.2 seconds 790 00:47:18.840 --> 00:47:21.441 Let me set this 0 at first 791 00:47:21.491 --> 00:47:24.591 This will be initialized to 0 in the constructor anyway 792 00:47:24.592 --> 00:47:26.892 You don't have to worry about it 793 00:47:26.892 --> 00:47:28.970 AutoFire is also a bool type 794 00:47:28.971 --> 00:47:30.321 Let's also initialize this one to 0 795 00:47:30.322 --> 00:47:32.672 And in bool, 0 is false 796 00:47:32.673 --> 00:47:35.273 Typically, bool type 797 00:47:36.320 --> 00:47:39.451 It's yes or no, true or false 798 00:47:39.451 --> 00:47:42.851 For true, if it's not 0 then it's true 799 00:47:42.851 --> 00:47:44.702 If it's 0, it's false 800 00:47:44.703 --> 00:47:48.253 So it's typically initialized to false 801 00:47:48.600 --> 00:47:51.399 Like so 802 00:47:56.299 --> 00:47:58.660 Then I'll try implementing this using that information 803 00:47:58.660 --> 00:48:01.810 I'll copy this part 804 00:48:01.959 --> 00:48:04.450 And try implementing it in the Tick function 805 00:48:04.451 --> 00:48:07.001 Let's start writing down here 806 00:48:07.852 --> 00:48:11.252 Then we have these three concepts like this 807 00:48:14.900 --> 00:48:21.290 So, if the concept of shooting is activated 808 00:48:21.291 --> 00:48:28.891 It would be like this when it's if, true 809 00:48:29.391 --> 00:48:34.110 When you write things like this, you often use phrases like these 810 00:48:34.110 --> 00:48:35.940 I used to write like this a lot in the past too 811 00:48:35.941 --> 00:48:37.641 But it causes us to make mistakes 812 00:48:37.642 --> 00:48:40.892 Because" I can accidentally omit suffixes 813 00:48:40.893 --> 00:48:41.893 There won't be any error 814 00:48:41.894 --> 00:48:43.494 You never know you've made a mistake 815 00:48:44.190 --> 00:48:46.880 It might take one to two hours to find it 816 00:48:46.881 --> 00:48:50.131 Therefore, the trend isn't writing like this 817 00:48:50.132 --> 00:48:52.182 Writing in the left side is a trend 818 00:48:52.182 --> 00:48:55.879 So if you take it out, an error occurs 819 00:48:56.830 --> 00:48:58.880 This isn't something important but 820 00:48:58.881 --> 00:49:01.580 These days, there are trends in development 821 00:49:01.580 --> 00:49:03.249 They say it's done a lot like this 822 00:49:03.250 --> 00:49:05.950 I do it this way as well these days 823 00:49:06.201 --> 00:49:07.901 But my old habits come out sometimes 824 00:49:07.902 --> 00:49:09.552 I sometimes write in the right side 825 00:49:09.552 --> 00:49:11.989 Keep it in mind 826 00:49:11.990 --> 00:49:14.690 So that means we do it like this 827 00:49:15.189 --> 00:49:17.909 So if the shooting function has been activated 828 00:49:17.910 --> 00:49:18.517 I'll say this 829 00:49:18.518 --> 00:49:19.518 First, we'll need to have the time flow 830 00:49:22.199 --> 00:49:23.449 And Second 831 00:49:23.449 --> 00:49:26.549 If current time 832 00:49:27.199 --> 00:49:29.329 Is the time to fire 833 00:49:29.330 --> 00:49:31.230 When the firing time comes 834 00:49:31.231 --> 00:49:32.931 Let's say this 835 00:49:34.079 --> 00:49:36.919 Then I want to create a third bullet 836 00:49:36.920 --> 00:49:39.570 Fourth 837 00:49:39.570 --> 00:49:45.520 I want to reset the current time to 0 838 00:49:47.129 --> 00:49:51.649 If is missing 839 00:49:54.399 --> 00:49:56.079 Resetting to zero is like starting over 840 00:49:56.080 --> 00:49:57.630 Almost like clapping 841 00:49:57.631 --> 00:49:59.331 We have right and left hand 842 00:49:59.332 --> 00:50:01.632 Let's say left side hand is fixed 843 00:50:01.632 --> 00:50:05.439 As right hand moves and meets left hand make a sound 844 00:50:05.440 --> 00:50:07.890 Bring right hand to its original position 845 00:50:07.891 --> 00:50:09.341 Then you can make a sound again 846 00:50:09.439 --> 00:50:11.899 Similar to that, by resetting to zero like this 847 00:50:11.900 --> 00:50:15.150 I'll make it go round and round again by increasing it like this 848 00:50:15.199 --> 00:50:19.400 So then, each time that time comes, it goes tap and tap 849 00:50:19.401 --> 00:50:21.851 Then, at that moment, it starts shooting bullets 850 00:50:22.000 --> 00:50:23.750 Then the time must flow 851 00:50:23.751 --> 00:50:27.101 You can accumulate 852 00:50:27.102 --> 00:50:29.952 And add a specific time to CurrentTime like this 853 00:50:29.953 --> 00:50:32.053 The only time we've learned here up until now is 854 00:50:32.053 --> 00:50:33.660 Just one 855 00:50:33.661 --> 00:50:37.061 Which is delta seconds, delta time 856 00:50:37.362 --> 00:50:40.162 I'll just accumulate this delta time right here 857 00:50:40.360 --> 00:50:44.079 Delta time is the time it takes to draw one frame 858 00:50:44.080 --> 00:50:45.680 For example, if we have 60 frames per second 859 00:50:45.681 --> 00:50:48.481 If we have 60 FPS currently 860 00:50:48.679 --> 00:50:50.970 Then the delta time would be 1/60 861 00:50:50.971 --> 00:50:54.321 If Tick is called 60 times 862 00:50:54.322 --> 00:50:57.880 Then CurrentTime would contain 1 second 863 00:50:58.320 --> 00:50:59.419 Of course 1 goes in 864 00:50:59.420 --> 00:51:03.570 We added 1/60 sixty times, so it becomes 1 865 00:51:04.121 --> 00:51:09.821 So, in practice, when we accumulate delta time until it reaches 1 866 00:51:09.919 --> 00:51:12.479 That's when one second has passed 867 00:51:12.480 --> 00:51:16.580 So, that's how you should understand this 868 00:51:16.879 --> 00:51:19.360 If 869 00:51:20.000 --> 00:51:22.760 CurrentTime has 870 00:51:25.399 --> 00:51:29.929 Exceeded Fire Time 871 00:51:29.929 --> 00:51:31.639 IF the time reached certain time 872 00:51:31.639 --> 00:51:33.740 It means that they have arrived 873 00:51:34.241 --> 00:51:36.641 Time has come" means we've reached that point 874 00:51:36.691 --> 00:51:38.799 I will write exceeds 875 00:51:38.800 --> 00:51:40.000 Then, we want a gun 876 00:51:40.001 --> 00:51:41.501 But it's already implemented 877 00:51:41.502 --> 00:51:44.502 We've already made a function called MakeBullet 878 00:51:44.502 --> 00:51:47.440 Let's create MakeBullet here 879 00:51:48.241 --> 00:51:50.791 This is why I made an extra function 880 00:51:50.879 --> 00:51:56.199 Then we need to reset CurrentTime to 0 at this point 881 00:51:57.760 --> 00:52:00.829 Sometimes people write it here like this 882 00:52:00.830 --> 00:52:01.830 Don't do that 883 00:52:01.831 --> 00:52:03.381 You won't be able to do this forever 884 00:52:03.382 --> 00:52:07.782 Because after adding 1/60 885 00:52:07.879 --> 00:52:10.179 It is reset to 0 886 00:52:10.180 --> 00:52:12.130 So when come back was 0 887 00:52:12.131 --> 00:52:15.181 Another 1/60 cumulates 888 00:52:15.182 --> 00:52:16.732 It keeps becoming 0 889 00:52:17.479 --> 00:52:18.829 That's why this shouldn't be here 890 00:52:18.829 --> 00:52:20.290 But inside here 891 00:52:20.291 --> 00:52:24.891 That way when it reaches, it will reset to 0 892 00:52:24.891 --> 00:52:27.669 We call it interval 893 00:52:27.670 --> 00:52:29.770 We can make intervals 894 00:52:31.169 --> 00:52:35.509 Now let's run it 895 00:52:35.510 --> 00:52:37.510 Compile it 896 00:52:40.659 --> 00:52:43.279 But now that I think about it 897 00:52:43.280 --> 00:52:45.580 For this AutoFire 898 00:52:45.581 --> 00:52:48.881 We haven't implemented the part where it is true or false 899 00:52:48.881 --> 00:52:51.249 Come back down 900 00:52:51.250 --> 00:52:52.250 Right here 901 00:52:52.501 --> 00:52:55.251 We need to enable or disable the shooting feature 902 00:52:55.399 --> 00:53:02.159 So here, we set bAutoFire to true 903 00:53:02.159 --> 00:53:08.399 Here, we'll set bAutoFire to false 904 00:53:10.760 --> 00:53:16.360 And during this process, the time keeps increasing 905 00:53:16.760 --> 00:53:17.800 It keeps increasing 906 00:53:17.800 --> 00:53:19.350 For example, there might be a case like this 907 00:53:19.351 --> 00:53:20.951 Let's say this is true 908 00:53:21.199 --> 00:53:24.659 And Fire time is 0.2 seconds 909 00:53:24.660 --> 00:53:27.560 With current time being 0.19 seconds 910 00:53:27.561 --> 00:53:30.961 In that state, I release the button 911 00:53:31.159 --> 00:53:35.080 When you press again, it will start from 0.9 seconds again 912 00:53:35.731 --> 00:53:38.431 Sorry not 0.9, since it's 0.2 seconds 913 00:53:38.431 --> 00:53:40.032 0.19 seconds I meant 914 00:53:40.080 --> 00:53:44.239 If it starts at 0.19 seconds, the bullet will immediately fire 915 00:53:44.239 --> 00:53:46.400 When you press and release 916 00:53:46.401 --> 00:53:48.901 It might change the sensitivity in such cases 917 00:53:49.000 --> 00:53:53.560 So, resetting CurrentTime to 0 here 918 00:53:54.709 --> 00:53:57.420 Would help start the interval more accurately and consistently 919 00:53:57.421 --> 00:54:01.371 Which should allow for more precise timing intervals 920 00:54:01.520 --> 00:54:06.639 Let's try it out first with these changes and see the results 921 00:54:13.879 --> 00:54:18.009 if you set it up this way, shoots when pressed and stop when released 922 00:54:18.010 --> 00:54:20.310 Shoots when pressed 923 00:54:20.310 --> 00:54:22.011 But we have a problem here 924 00:54:22.011 --> 00:54:23.380 Look, If I quickly 925 00:54:23.381 --> 00:54:26.381 Press the button and release it 926 00:54:27.280 --> 00:54:29.000 Nothing fires 927 00:54:29.001 --> 00:54:32.801 Because I released my hand during the interval, that's why 928 00:54:33.000 --> 00:54:34.640 So this is a kind of problem 929 00:54:34.641 --> 00:54:36.591 To improve this 930 00:54:36.592 --> 00:54:39.442 I want to make it shoot right when pressed 931 00:54:40.940 --> 00:54:44.170 That way, it will shoot as soon as I press it 932 00:54:44.171 --> 00:54:45.271 So when pressed 933 00:54:45.820 --> 00:54:48.220 MakeBullet at first 934 00:54:48.221 --> 00:54:52.071 Create a MakeBullet 935 00:54:53.479 --> 00:54:56.120 So with this setup, we activate the shooting function 936 00:54:56.121 --> 00:54:58.271 Create and fire one shot initially 937 00:54:58.272 --> 00:54:59.472 When goes into interval 938 00:54:59.472 --> 00:55:01.123 Then it shoots normally 939 00:55:01.123 --> 00:55:04.680 So when I click faster, it shoots faster 940 00:55:04.780 --> 00:55:07.630 Something like that 941 00:55:07.679 --> 00:55:12.600 So, compile it again 942 00:55:17.570 --> 00:55:21.919 If we click faster, it shoots well 943 00:55:26.679 --> 00:55:31.160 Let me summarize the content we learned in this session 944 00:55:31.161 --> 00:55:32.161 Bullet Actors, Movement, Input Handling, and Firing Bullet Creation Creating a New Actor Class and Assigning it as a Bullet 945 00:55:32.162 --> 00:55:33.162 UBoxComponent BoxComp declared a collision component UStaticMeshComponent MeshComp declared a visual appearance component 946 00:55:33.163 --> 00:55:34.163 Added the Components BoxComponent header file Added CreateDefaultSubobject 947 00:55:34.164 --> 00:55:35.164 Firing Bullet Functionality Added Tick function for forward movement 948 00:55:35.164 --> 00:55:36.164 Added a float variable named Speed and set it to 1000 Applied GetActorForwardVector for firing in the forward direction 949 00:55:36.165 --> 00:55:37.165 Bullet Creation Function Added Action Mapping in Project Settings under Input Named the new action Fire and assigned it to the left mouse button 950 00:55:37.166 --> 00:55:38.166 Implemented the OnActionFire function Added a MakeBullet function that creates a bullet when Fire is pressed Added BulletActor header file 951 00:55:38.167 --> 00:55:39.167 After moving to the Player, placed BP BulletActor in Bullet Factory under Class Defaults 952 00:55:39.168 --> 00:55:40.168 Automatic Bullet Firing Functionality Improved OnActionFire function to OnActionFirePressed and OnActionFireReleased functions 953 00:55:40.169 --> 00:55:41.169 Created a separate function for IE Released behavior for the same action Added properties for implementing MakeBullet 954 00:55:41.170 --> 00:55:42.520 Handling Bullet Firing Sound Bullet Firing Sound Functionality Created a folder for inserting audio files 955 00:55:42.520 --> 00:55:43.721 Dragged and added the bullet firing sound effect file to the folder Moved to the player and added sound effects when invoking MakeBullet Added PlaySound2D to the MakeBullet function 956 00:55:43.721 --> 00:55:45.222 Added GetWorld and FireSound as arguments to the PlaySound2D function call Added Kismet GameplayStatics header file 957 00:55:45.222 --> 00:55:46.222 The End