All language subtitles for 001 Making the Charged Shot[UdemyIran.Com]

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian Download
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:00,110 --> 00:00:03,170 In this video we're going to create the charge shot ability. 2 00:00:03,170 --> 00:00:05,510 And things do get a little bit more complicated here. 3 00:00:05,510 --> 00:00:09,470 So if you find it hard to follow along, please make sure to use the controls on the video to maybe 4 00:00:09,470 --> 00:00:12,320 play a 0.5 speed and slowly follow along. 5 00:00:12,320 --> 00:00:16,309 But everything you're learning here is going to be very important and going to set you up to create 6 00:00:16,309 --> 00:00:18,110 your own abilities in the future. 7 00:00:18,110 --> 00:00:21,860 And it's also going to show you the kind of problems that can come up in the edge cases, and how we 8 00:00:21,860 --> 00:00:27,170 fix these in these Mega man clones, a charge shot ability is a staple, and you can hold the button 9 00:00:27,170 --> 00:00:28,070 to charge up your shot. 10 00:00:28,070 --> 00:00:32,930 And if you wait a set amount of time, if you let go, you get a stronger version of the projectile. 11 00:00:33,200 --> 00:00:37,670 Before we get into making the projectile itself, let's just first go into the player and see how we 12 00:00:37,670 --> 00:00:40,910 can even detect if we hold the button and when we let go of the button. 13 00:00:41,060 --> 00:00:44,540 So in the player we can see the IA shoot event. 14 00:00:44,750 --> 00:00:50,420 If we look for it, we have the Beginplay I jump, I move and IA shoot right? 15 00:00:50,420 --> 00:00:56,150 So if we let go of the button we then want to decide do we shoot the irregular projectile here or do 16 00:00:56,150 --> 00:00:57,350 we shoot the. 17 00:00:58,210 --> 00:01:01,360 Or do we shoot the charged projectile which we're going to create later? 18 00:01:01,480 --> 00:01:06,310 And if we open this up, you can see that we have a lot of different things here, like elapsed seconds 19 00:01:06,310 --> 00:01:08,560 and ongoing and triggered seconds. 20 00:01:08,560 --> 00:01:10,330 There's a lot of things here we can use. 21 00:01:10,330 --> 00:01:15,250 However, to enable these we need to change the input action for the shooting a little bit. 22 00:01:15,640 --> 00:01:21,190 So in the content drawer we can go to content go to Input and Actions. 23 00:01:21,190 --> 00:01:22,990 And we have our IA shoot. 24 00:01:22,990 --> 00:01:25,420 But actually what we change is not in the action itself. 25 00:01:25,420 --> 00:01:28,210 It is in the IMC action the binding. 26 00:01:28,210 --> 00:01:34,480 So in here where we go to the IA shoot, there is a trigger which we want to implement. 27 00:01:34,480 --> 00:01:40,570 And in here if we click we have a bunch of options here like down hold, hold and release pressed and 28 00:01:40,570 --> 00:01:41,860 all of these different things. 29 00:01:41,860 --> 00:01:47,350 But the one that we want to use is released because we want to check when did we release the button, 30 00:01:47,350 --> 00:01:52,810 and if enough time expired for us to be able to use the charged shot or not. 31 00:01:53,410 --> 00:01:55,390 And here make sure to save. 32 00:01:55,810 --> 00:01:59,350 And now in the BP player, well, we can just close all of these things down. 33 00:01:59,350 --> 00:02:00,850 Let's just open up the BP player. 34 00:02:00,850 --> 00:02:01,810 Nothing else. 35 00:02:01,810 --> 00:02:05,350 And here we now have access to the elapsed seconds. 36 00:02:05,350 --> 00:02:10,630 So now on completed which happens if we let go of the button we can just print string. 37 00:02:11,910 --> 00:02:14,760 And we can look for the elapsed seconds. 38 00:02:15,730 --> 00:02:17,080 And let's try this out. 39 00:02:17,820 --> 00:02:19,290 I can still shoot normally, right? 40 00:02:19,290 --> 00:02:22,590 But now I'm holding the button and I let go now. 41 00:02:22,590 --> 00:02:26,760 And you can see we held the button for 2.5 seconds and I hold it again. 42 00:02:26,760 --> 00:02:30,750 I let go and you can see like how long I'm holding the button. 43 00:02:30,750 --> 00:02:34,950 So let's say for example we want the charge projectile to work after two seconds. 44 00:02:34,950 --> 00:02:41,400 Then we simply check for this number and then decide if we are allowed to spawn the charge projectile 45 00:02:41,400 --> 00:02:41,970 or not. 46 00:02:41,970 --> 00:02:43,590 So this is the first step. 47 00:02:43,590 --> 00:02:44,430 This is working. 48 00:02:44,430 --> 00:02:47,430 But now we have to actually create these projectiles. 49 00:02:47,940 --> 00:02:51,630 And the good thing is that we already thought ahead with our inheritance pattern, right. 50 00:02:51,630 --> 00:02:57,240 So so far we only created the base, we created the player base and we created the regular one. 51 00:02:57,240 --> 00:03:04,380 But now what we want to create is the partially charged shot and the fully charged shot based on the 52 00:03:04,740 --> 00:03:05,970 player projectile base. 53 00:03:05,970 --> 00:03:09,210 And then if we let go of the button, we simply have to decide to respawn. 54 00:03:09,210 --> 00:03:10,050 Nothing. 55 00:03:10,080 --> 00:03:13,950 Do we spawn the partially charged shot or do we spawn the fully charged shot? 56 00:03:13,950 --> 00:03:17,070 So back in the content drawer, let's go to blueprints. 57 00:03:17,100 --> 00:03:18,450 Go to projectiles. 58 00:03:18,450 --> 00:03:22,680 And here in the player we have the BP player projectile base. 59 00:03:22,680 --> 00:03:26,250 Right click this and create Child Blueprint class. 60 00:03:26,490 --> 00:03:28,440 And let's do the partially one first. 61 00:03:28,440 --> 00:03:31,260 So BP player projectile. 62 00:03:32,010 --> 00:03:34,500 Partial charge. 63 00:03:35,720 --> 00:03:36,260 In here. 64 00:03:36,260 --> 00:03:37,640 We don't really want to do much. 65 00:03:37,640 --> 00:03:41,690 Just open it up and we want to just change the color. 66 00:03:41,690 --> 00:03:43,070 I don't have a different animation. 67 00:03:43,070 --> 00:03:47,120 I don't have a different flipbook for this one because there was none in the assets. 68 00:03:47,120 --> 00:03:52,280 But we can easily make this look different from the basic one by going to the sprite color here and 69 00:03:52,280 --> 00:03:53,780 just making it purple. 70 00:03:54,290 --> 00:03:57,050 And this is just so we know that this is the partially charged shot. 71 00:03:57,050 --> 00:03:59,120 It's different than the regular shot. 72 00:03:59,120 --> 00:04:05,660 And if you wanted to you could go here on the right side and you could adjust the projectile damage 73 00:04:05,660 --> 00:04:07,700 to maybe two instead of one. 74 00:04:07,700 --> 00:04:09,920 But this depends on what you want to do. 75 00:04:09,920 --> 00:04:15,110 I believe in the original games, it actually has only the same damage as the regular projectile, so 76 00:04:15,110 --> 00:04:16,700 I'm just going to keep this as one. 77 00:04:16,700 --> 00:04:18,680 The fully charged one is going to be three damage. 78 00:04:18,680 --> 00:04:21,470 So if you wanted, you could actually set this to two damage. 79 00:04:21,470 --> 00:04:23,960 And this is all we're going to do for the partial charge shot. 80 00:04:23,960 --> 00:04:25,580 So just go out here. 81 00:04:25,580 --> 00:04:30,080 And now again from the BP player projectile base right click Create Child. 82 00:04:30,080 --> 00:04:33,740 And let's create the BP player projectile. 83 00:04:34,470 --> 00:04:36,210 Full charge. 84 00:04:36,940 --> 00:04:38,980 And open it up here. 85 00:04:38,980 --> 00:04:41,140 We actually want to change a couple of things. 86 00:04:41,140 --> 00:04:44,290 Well, the first thing is we want it to deal three damage. 87 00:04:44,290 --> 00:04:47,380 So projectile damage three it should deal more damage. 88 00:04:47,380 --> 00:04:51,490 This is going to be used if you have to fight airborne enemies and you need to time your shots. 89 00:04:51,490 --> 00:04:55,780 It is going to be beneficial from a gameplay perspective to use the charge shot. 90 00:04:55,780 --> 00:04:58,630 The next thing we want to change is the paper flipbook. 91 00:04:58,630 --> 00:05:03,280 So here for the source flipbook we can just look for shoot charge, right? 92 00:05:03,280 --> 00:05:07,780 We have the player shoot charge one and you can see this is it. 93 00:05:07,780 --> 00:05:08,500 Right. 94 00:05:08,500 --> 00:05:11,170 And we might want to adjust the sprite location a little bit. 95 00:05:11,170 --> 00:05:15,400 Just move it backwards a little bit to make it a bit more accurate. 96 00:05:15,400 --> 00:05:19,450 And this is again everything we have to do for this fully charged shot. 97 00:05:19,450 --> 00:05:20,440 And why is this so easy? 98 00:05:20,440 --> 00:05:22,270 Because we have been using inheritance. 99 00:05:22,270 --> 00:05:26,920 We have been thinking about our pattern from the beginning, and it makes it very easy to just create 100 00:05:26,920 --> 00:05:28,060 variants like this. 101 00:05:28,360 --> 00:05:32,620 And now that I think about just to give the charge shot a little bit of more utility, we can also just 102 00:05:32,620 --> 00:05:34,990 change the speed, make it feel even more powerful. 103 00:05:34,990 --> 00:05:37,750 So let's just go for 1300. 104 00:05:37,750 --> 00:05:41,560 We don't want it to change too much, but just make it a little bit faster. 105 00:05:41,560 --> 00:05:44,740 Make it a little bit more snappier to make it feel even more powerful. 106 00:05:44,740 --> 00:05:47,230 Let's go back to the player blueprint. 107 00:05:47,530 --> 00:05:49,480 You can just close this down and yeah. 108 00:05:49,480 --> 00:05:54,820 So now here after completed, we want to decide if we actually want to spawn a projectile or not. 109 00:05:54,820 --> 00:06:00,370 But we will also keep this code on start right because we want to shoot a projectile anyway on start. 110 00:06:00,930 --> 00:06:06,270 And we want to make all of this reusable, because now if we just copy paste all of this, it's going 111 00:06:06,270 --> 00:06:07,650 to be a little bit of a mess. 112 00:06:07,650 --> 00:06:13,080 And we just want to be able to just pass the class in here, the pseudonym, the duration, everything 113 00:06:13,080 --> 00:06:14,010 is going to stay the same. 114 00:06:14,010 --> 00:06:19,770 So we just want to create a function where we can pass the shot energy and where we can pass the class, 115 00:06:19,770 --> 00:06:24,480 and we can then just give it different parameters for the partial shot, for the fully charged and all 116 00:06:24,480 --> 00:06:25,350 of these things. 117 00:06:25,350 --> 00:06:28,830 But all of the things we are doing here on started, like shooting the regular projectile. 118 00:06:28,830 --> 00:06:34,860 We're still going to use this as it is, but we want to reuse some of these things so we can then use 119 00:06:34,860 --> 00:06:37,170 them at the bottom here when we shoot a projectile. 120 00:06:37,170 --> 00:06:40,740 And the first thing I want to do is take care of the shoot animation. 121 00:06:40,740 --> 00:06:45,990 So we have the is shooting to true and we have the delay for the shoot em duration. 122 00:06:45,990 --> 00:06:47,220 And then the is shooting here. 123 00:06:47,220 --> 00:06:49,650 So I actually want to separate this from here. 124 00:06:49,650 --> 00:06:51,240 So we can use alt here. 125 00:06:52,000 --> 00:06:54,730 Go up here and just move it around. 126 00:06:54,730 --> 00:06:56,380 And also take this out here. 127 00:06:56,970 --> 00:07:01,650 And now this is just going to be about the shooting animation, the shooting logic. 128 00:07:01,800 --> 00:07:03,780 Uh, not about the spawning projectile. 129 00:07:03,780 --> 00:07:03,960 Right. 130 00:07:03,960 --> 00:07:05,460 So we can just connect this. 131 00:07:05,820 --> 00:07:07,080 So this is now separate. 132 00:07:07,080 --> 00:07:13,140 This cares about spawning projectiles and the shot energy, and this cares about the shoot anim duration. 133 00:07:13,140 --> 00:07:15,330 So here we can just make another custom event. 134 00:07:17,760 --> 00:07:19,200 And call it trigger. 135 00:07:19,200 --> 00:07:21,960 Shoot Annam like this. 136 00:07:23,020 --> 00:07:31,120 And now, instead of having all this here, we can just call trigger shoot anim here. 137 00:07:31,120 --> 00:07:33,760 And all of this is going to happen during the same frame. 138 00:07:33,760 --> 00:07:37,360 So you might think we want to play the animation first and then shoot the projectile. 139 00:07:37,390 --> 00:07:39,160 But everything happens during the same frame. 140 00:07:39,160 --> 00:07:41,590 So there's really not a difference in this case. 141 00:07:41,590 --> 00:07:47,770 And now we just want to take this and move it to a different place where it's a little bit less crowded. 142 00:07:49,500 --> 00:07:49,860 Yeah. 143 00:07:49,860 --> 00:07:50,610 Down here. 144 00:07:52,900 --> 00:07:56,170 And again, just to show that the shooting still works, right? 145 00:07:56,170 --> 00:07:57,610 Everything still works the same. 146 00:07:58,620 --> 00:08:02,280 But we just made it a little bit cleaner, a little bit more reusable. 147 00:08:03,220 --> 00:08:08,350 The next thing we want to do is to make the part where we spawn the projectile, where we have the shot 148 00:08:08,350 --> 00:08:11,770 energy being subtracted and the projectile being shot. 149 00:08:11,770 --> 00:08:17,050 We now want to make this more modular, so instead of just doing minus, minus, we want to be able 150 00:08:17,050 --> 00:08:21,820 to decide do we want to subtract one for a regular shot or three for the charge shot? 151 00:08:21,820 --> 00:08:27,040 And also do we want to spawn the charged projectile, the partial charge projectile. 152 00:08:27,040 --> 00:08:30,610 So it's best to just collapse all of this into a function. 153 00:08:30,940 --> 00:08:35,260 So if we have all of this selected, we can just right click and collapse to function. 154 00:08:36,309 --> 00:08:38,770 And just call it spawn projectile. 155 00:08:39,809 --> 00:08:41,970 Like this and move it here. 156 00:08:41,970 --> 00:08:42,210 Right. 157 00:08:42,210 --> 00:08:43,980 So the conditions this is fine. 158 00:08:44,159 --> 00:08:48,090 And in here we just, uh, clean this up a little bit. 159 00:08:48,090 --> 00:08:53,520 And what we want to do now here is we want to be able to pass this class in here so we can just drag 160 00:08:53,520 --> 00:08:55,200 off the class here. 161 00:08:55,200 --> 00:08:57,360 And it creates a new input node. 162 00:08:57,360 --> 00:08:59,310 And I just want to compile and save. 163 00:08:59,310 --> 00:09:04,050 And I want to change the name to from class to projectile class. 164 00:09:04,930 --> 00:09:08,740 And this works fine, but it's not so nice to have this line here, right? 165 00:09:09,040 --> 00:09:11,950 Uh, so there's actually a shortcut we can do. 166 00:09:11,950 --> 00:09:14,500 And for this, it's very important that we compile save. 167 00:09:14,530 --> 00:09:15,850 Otherwise, not gonna work. 168 00:09:15,850 --> 00:09:21,100 We can just write the same name here, just drag off here and just write projectile class. 169 00:09:21,100 --> 00:09:25,240 And it's going to show up here because this is basically a local variable. 170 00:09:25,420 --> 00:09:29,080 And we just use this and just shortcut it to here. 171 00:09:29,080 --> 00:09:30,040 So it's just cleaner. 172 00:09:30,040 --> 00:09:32,290 But it's the same thing as just connecting it here. 173 00:09:32,440 --> 00:09:35,560 And the longer your function is the easier this becomes to use. 174 00:09:35,560 --> 00:09:38,260 Because otherwise you would just have to drag off here, here, here, here. 175 00:09:38,260 --> 00:09:39,910 And it's just going to become a mess. 176 00:09:39,910 --> 00:09:45,340 But one thing with this is that if we rename this input, this reference is going to be corrupted. 177 00:09:45,340 --> 00:09:47,830 So we actually need to refresh this reference in that case. 178 00:09:47,830 --> 00:09:49,630 So just be careful with that. 179 00:09:49,990 --> 00:09:51,940 So now let's just have a look at how this works. 180 00:09:51,940 --> 00:09:52,210 Right. 181 00:09:52,210 --> 00:09:57,280 I can go back to the event graph where we shoot the IA shoot. 182 00:09:57,280 --> 00:09:58,870 And here the projectile class. 183 00:09:58,870 --> 00:10:01,090 Now I can just select a projectile. 184 00:10:01,090 --> 00:10:03,730 Well actually the problem is I can select everything. 185 00:10:03,730 --> 00:10:08,170 So in the function or if we just select the function here we see the class right. 186 00:10:08,170 --> 00:10:10,480 So the projectile class is the input here. 187 00:10:10,480 --> 00:10:12,880 And right now it is an actor. 188 00:10:12,880 --> 00:10:14,740 But we actually want to make this more specific. 189 00:10:14,740 --> 00:10:16,810 So we can only pick projectiles. 190 00:10:16,810 --> 00:10:20,050 So we can just go here and type in projectile. 191 00:10:20,810 --> 00:10:26,780 And we have the BP projectile base, but only the player uses this function, right. 192 00:10:26,780 --> 00:10:33,560 So it could be a BP player projectile base and not an object reference, but a class reference. 193 00:10:33,800 --> 00:10:35,300 And just compile and save. 194 00:10:36,000 --> 00:10:37,020 And we might get an error here. 195 00:10:37,020 --> 00:10:42,540 Now this is fine, but now we can only select player projectiles here so we cannot pick something else 196 00:10:42,540 --> 00:10:43,590 on accident. 197 00:10:43,590 --> 00:10:46,770 And let's just try the fully charged shot for now. 198 00:10:46,890 --> 00:10:48,780 And let's look at the error. 199 00:10:48,780 --> 00:10:50,010 So projectile class. 200 00:10:50,010 --> 00:10:50,430 Yeah. 201 00:10:50,430 --> 00:10:55,020 So this just because the type changed we just have to right click and refresh. 202 00:10:55,020 --> 00:10:56,400 No actually we can't refresh. 203 00:10:56,400 --> 00:10:58,140 We just have to get rid of this. 204 00:10:58,140 --> 00:10:59,910 Now just compile and save. 205 00:10:59,910 --> 00:11:03,990 And here drag off again and just right the projectile class again. 206 00:11:03,990 --> 00:11:07,650 And this is what I meant with the reference can become corrupted. 207 00:11:07,650 --> 00:11:11,940 And we just have to like retype the thing so it understands it's of the same type. 208 00:11:12,870 --> 00:11:14,730 So now let's just try this out. 209 00:11:14,730 --> 00:11:18,240 And here, if I shoot now, I shoot the charged projectile. 210 00:11:19,030 --> 00:11:19,510 Right. 211 00:11:19,510 --> 00:11:20,650 So this works. 212 00:11:20,650 --> 00:11:23,380 We can then only here in the van graph. 213 00:11:23,380 --> 00:11:23,620 Right. 214 00:11:23,620 --> 00:11:26,440 We can simply select which projectile we want to shoot. 215 00:11:26,440 --> 00:11:27,760 So this is a reusable. 216 00:11:27,760 --> 00:11:30,040 Now we can use this for all of the different projectiles. 217 00:11:30,040 --> 00:11:33,910 However one problem we still have in here is the shot energy. 218 00:11:33,910 --> 00:11:39,730 So in the case that the projectile is a fully charged projectile, we want to subtract three. 219 00:11:39,730 --> 00:11:42,970 If it's a regular or a partially charged one, just one is fine. 220 00:11:42,970 --> 00:11:44,800 So we need to actually update this here. 221 00:11:45,100 --> 00:11:49,330 So instead of doing minus minus we have to do it a little bit differently. 222 00:11:49,330 --> 00:11:52,720 And we can get the shot energy. 223 00:11:52,720 --> 00:11:53,740 Where is it here. 224 00:11:53,950 --> 00:11:56,050 And we set shot energy. 225 00:11:56,050 --> 00:11:57,910 So how do we set this right. 226 00:11:57,910 --> 00:12:04,030 We have the current shot energy minus subtract the value that we want to get rid of. 227 00:12:04,030 --> 00:12:08,050 So -1 or -3 and disconnect this back here. 228 00:12:08,850 --> 00:12:13,020 But how does this function know if we want to do -1 or -3? 229 00:12:13,050 --> 00:12:18,630 Because we cannot simply drag this projector and it doesn't know, we need to create a mapping to tell 230 00:12:18,630 --> 00:12:18,900 it. 231 00:12:18,900 --> 00:12:21,480 Hey, if it's this projectile, just subtract one. 232 00:12:21,480 --> 00:12:23,220 If it's this projectile, subtract three. 233 00:12:23,220 --> 00:12:26,280 And mappings can be very useful for these kind of things. 234 00:12:26,610 --> 00:12:28,740 So how do we create a mapping. 235 00:12:29,040 --> 00:12:31,170 We can create it as a new variable. 236 00:12:31,170 --> 00:12:34,620 Can just go here and just call it projectile. 237 00:12:35,680 --> 00:12:36,760 To. 238 00:12:37,560 --> 00:12:38,610 Energy. 239 00:12:39,530 --> 00:12:40,850 And compile and save. 240 00:12:40,850 --> 00:12:44,480 And here on the right side it should be of variable type. 241 00:12:44,480 --> 00:12:47,600 Again the projectile which we used before right. 242 00:12:47,600 --> 00:12:52,700 The BP player projectile base class reference and compile and save. 243 00:12:52,700 --> 00:12:57,980 And here we want to change this from a regular variable to a map variable. 244 00:12:58,490 --> 00:13:01,820 And this basically just lets us connect two different types together. 245 00:13:01,820 --> 00:13:04,640 So we can say if this is the case then use this. 246 00:13:04,670 --> 00:13:06,830 If this is the case, use the other one. 247 00:13:07,010 --> 00:13:10,610 And here yes, we want to have a mapping from the player projectile to an integer. 248 00:13:10,610 --> 00:13:13,880 But here we could also have like anything else we could have one class to another. 249 00:13:13,880 --> 00:13:16,580 You could have to a boolean all of these things right. 250 00:13:16,580 --> 00:13:18,110 And we just compile save. 251 00:13:19,320 --> 00:13:22,590 And here in the default value we can now set our mapping. 252 00:13:22,590 --> 00:13:27,120 So this plus here and the first one we want to look at is the full charge right. 253 00:13:27,120 --> 00:13:32,520 So if it's a full charge we want to subtract three and press plus again. 254 00:13:32,520 --> 00:13:34,860 Then do the partial charge. 255 00:13:34,860 --> 00:13:37,050 In the partial charge it's just one. 256 00:13:37,050 --> 00:13:39,780 And then also put in the regular projectile. 257 00:13:39,780 --> 00:13:42,300 Regular is also just one. 258 00:13:42,300 --> 00:13:48,060 So we subtract one energy for the regular and the partial and three energy for the fully charged shot. 259 00:13:48,060 --> 00:13:49,440 And again just compile save. 260 00:13:49,440 --> 00:13:51,150 And now we actually have to use this right. 261 00:13:51,150 --> 00:13:54,690 So we can drag it out here get projectile to energy. 262 00:13:54,690 --> 00:13:56,310 And we can find. 263 00:13:57,000 --> 00:14:00,030 And this lets us look inside of the map which we created. 264 00:14:00,030 --> 00:14:01,560 And we can just connect this here. 265 00:14:01,560 --> 00:14:03,990 And it's going to give us right to find. 266 00:14:04,080 --> 00:14:08,880 We have to give it the left value and it's going to output the right value. 267 00:14:08,880 --> 00:14:11,880 So if we give it the fully charged it's going to output three. 268 00:14:11,880 --> 00:14:14,190 If we give it something else it's going to output one. 269 00:14:14,190 --> 00:14:17,970 And here again we can use the projectile class which we get passed in here. 270 00:14:18,450 --> 00:14:19,590 Projectile class. 271 00:14:19,590 --> 00:14:22,590 And this is how easy it is to use a mapping. 272 00:14:23,430 --> 00:14:27,570 And yeah, just clean this up a little bit and this should then work. 273 00:14:27,720 --> 00:14:34,890 But one thing I want to do here is just implement a safety net, because we never want to go below zero 274 00:14:34,890 --> 00:14:35,580 shot energy. 275 00:14:35,580 --> 00:14:40,320 We don't want to have like a bug or something that we go minus shot energy and we just accumulate minus 276 00:14:40,320 --> 00:14:42,840 and minus and we become unable to shoot. 277 00:14:42,840 --> 00:14:48,630 So here I just want to use max max integer and have zero. 278 00:14:48,630 --> 00:14:52,200 So max is just a kind of shortcut for clamping. 279 00:14:52,200 --> 00:14:57,000 And it's just going to make sure that if it goes through here it is going to use the higher value. 280 00:14:57,000 --> 00:15:00,180 It's going to use either this value or the zero if it's higher. 281 00:15:00,180 --> 00:15:04,440 So if this one goes to minus one, it's going to ignore this one and just use the zero. 282 00:15:04,440 --> 00:15:09,360 If this one is higher than zero, it's just going to use the higher one, right returns the maximum 283 00:15:09,360 --> 00:15:10,860 value of A and b. 284 00:15:11,800 --> 00:15:13,480 Just as a safety net. 285 00:15:13,480 --> 00:15:18,160 So now if I go back to the map and I shoot, I can actually only shoot one projectile at the time, 286 00:15:18,160 --> 00:15:22,660 even if I press very fast because we are using three shot energy. 287 00:15:22,660 --> 00:15:28,000 But one thing we also have to do actually have to recover three shot energy if the projectile is being 288 00:15:28,000 --> 00:15:28,750 destroyed. 289 00:15:28,750 --> 00:15:35,950 So in the player we have this function restore shot energy and we can just copy this over this projectile 290 00:15:35,980 --> 00:15:37,630 to enemy projectile class. 291 00:15:37,630 --> 00:15:41,800 Just copy control C and go to the restore shot energy. 292 00:15:41,800 --> 00:15:45,220 And again here we're just using this plus plus which we don't want. 293 00:15:45,340 --> 00:15:46,570 And we can just use this. 294 00:15:46,570 --> 00:15:47,800 Well this one is going to be corrupted. 295 00:15:47,800 --> 00:15:48,370 This is fine. 296 00:15:48,370 --> 00:15:50,020 We just want to use this one here. 297 00:15:50,020 --> 00:15:51,490 And here we can do the same thing. 298 00:15:51,490 --> 00:15:54,220 We're just going to drag into here to create the input. 299 00:15:54,430 --> 00:15:56,200 And I'm just gonna write. 300 00:15:56,200 --> 00:15:57,280 It's already player projectile. 301 00:15:57,280 --> 00:15:57,940 This is fine. 302 00:15:57,940 --> 00:15:59,560 Just call it projectile class. 303 00:16:01,220 --> 00:16:02,360 Just like this. 304 00:16:02,360 --> 00:16:08,750 And again I can disconnect this here, compile and save and then just shortcut here for the projectile 305 00:16:08,750 --> 00:16:09,260 class. 306 00:16:09,260 --> 00:16:10,550 Just make it cleaner. 307 00:16:10,550 --> 00:16:11,030 Right. 308 00:16:11,030 --> 00:16:12,320 So what do we want to do here. 309 00:16:12,320 --> 00:16:17,330 Well instead of plus plus again we can also copy paste some of this right. 310 00:16:17,330 --> 00:16:20,150 We want to get the shot energy and set the shot energy. 311 00:16:20,270 --> 00:16:25,520 So in the restore shot energy right here can just reuse this pattern. 312 00:16:26,610 --> 00:16:28,260 But it's going to be slightly different. 313 00:16:28,820 --> 00:16:29,840 Go here. 314 00:16:31,960 --> 00:16:33,700 And yes. 315 00:16:33,700 --> 00:16:37,450 So we don't want to go minus we want to go plus shot energy. 316 00:16:37,450 --> 00:16:37,990 Right. 317 00:16:37,990 --> 00:16:44,080 Add here and add the shot energy of this projectile type back. 318 00:16:44,590 --> 00:16:52,210 And here we don't want to use Max actually here we want to use min which is the opposite min integer. 319 00:16:52,630 --> 00:16:57,160 And this is going to give us back the smallest value between a and b. 320 00:16:57,340 --> 00:17:03,370 What we want to do here is to just make sure that we cannot recover more shot energy than our maximum. 321 00:17:03,370 --> 00:17:05,829 So the three shot energy is our maximum. 322 00:17:06,010 --> 00:17:08,140 So we can just put this to a variable right. 323 00:17:08,140 --> 00:17:10,630 So promote the variable not local variable variable. 324 00:17:10,630 --> 00:17:11,560 Very important. 325 00:17:11,560 --> 00:17:18,069 And just call it max or just shot energy max like this. 326 00:17:18,190 --> 00:17:20,050 And this is just going to return the smaller one. 327 00:17:20,050 --> 00:17:20,230 Right. 328 00:17:20,230 --> 00:17:23,800 So even if we threw some bug or something get a four here. 329 00:17:23,800 --> 00:17:25,569 It can never be higher than three. 330 00:17:25,569 --> 00:17:28,540 So it's just going to put the three as our shot energy. 331 00:17:28,540 --> 00:17:30,250 And now we just compile and save. 332 00:17:30,250 --> 00:17:33,850 And the restore shot energy is being called on the player projectile. 333 00:17:33,850 --> 00:17:37,210 So we have to go to the player projectile. 334 00:17:37,210 --> 00:17:37,420 Yes. 335 00:17:37,420 --> 00:17:41,410 Projectiles player blueprints projectiles player player projectile base. 336 00:17:41,770 --> 00:17:48,430 And well a simple way to find is just go find results or hit control F, and we can just go for restore. 337 00:17:48,430 --> 00:17:48,910 Right. 338 00:17:48,910 --> 00:17:51,100 And it shows us where the restore shot energy is. 339 00:17:51,100 --> 00:17:52,660 We don't have to look for it ourselves. 340 00:17:52,660 --> 00:17:55,390 And now it takes in this projectile class. 341 00:17:55,390 --> 00:17:57,340 And how do we get this class. 342 00:17:57,340 --> 00:18:02,110 Well we can just get self get a reference to self and then class. 343 00:18:03,930 --> 00:18:05,400 And I think it is here. 344 00:18:05,430 --> 00:18:06,840 Getclass. 345 00:18:07,170 --> 00:18:09,150 So we can get our own class. 346 00:18:09,800 --> 00:18:12,380 When being destroyed and just restore the shot energy. 347 00:18:12,380 --> 00:18:15,500 We just tell the player I am this type of projectile. 348 00:18:15,500 --> 00:18:21,020 I am being destroyed now so you can restore this type of shot energy and just compile and save. 349 00:18:21,050 --> 00:18:22,010 Do this again. 350 00:18:23,330 --> 00:18:26,690 And right now, actually it doesn't work because I forgot one thing. 351 00:18:26,690 --> 00:18:27,740 Sorry about that. 352 00:18:27,740 --> 00:18:34,250 In the max shot energy, we actually need to compile and save and set the max value, right? 353 00:18:34,250 --> 00:18:37,490 So if we have zero then we cannot ever have shot energy. 354 00:18:37,490 --> 00:18:40,430 So just set this to three and compile and save. 355 00:18:40,430 --> 00:18:42,530 And now it should work just fine right. 356 00:18:42,530 --> 00:18:44,960 So here I can shoot again I can shoot again. 357 00:18:44,960 --> 00:18:47,630 And this makes sure we don't have any bugs with the shot energy. 358 00:18:47,630 --> 00:18:50,420 And again I can only have one active at a time. 359 00:18:50,810 --> 00:18:55,790 And this is going to prevent bugs where we maybe don't restore enough energy or restore too much energy. 360 00:18:55,790 --> 00:19:01,520 So now that we have prepared everything with the energy, we can go back to the BP player and again 361 00:19:01,520 --> 00:19:03,200 find our IA shoot. 362 00:19:03,740 --> 00:19:08,150 And yes, for the regular shot, we just want to use the regular shot again. 363 00:19:08,150 --> 00:19:08,330 Right. 364 00:19:08,330 --> 00:19:09,890 So here just select the regular. 365 00:19:09,890 --> 00:19:11,210 We are done testing this. 366 00:19:11,210 --> 00:19:15,050 And now we want to move on to actually using this charge time here. 367 00:19:15,050 --> 00:19:18,350 And again the first thing we don't need to print string anymore. 368 00:19:18,410 --> 00:19:19,850 We again need to check. 369 00:19:19,850 --> 00:19:20,720 Are we not stunned. 370 00:19:20,720 --> 00:19:22,820 And do we have enough shot energy. 371 00:19:22,820 --> 00:19:27,740 Just like this and go here from the completed not the cancelled completed. 372 00:19:27,740 --> 00:19:28,640 Very important. 373 00:19:30,700 --> 00:19:32,200 And just do it like this. 374 00:19:33,180 --> 00:19:38,880 And one thing we have here now is that we just check for shot energy bigger than zero. 375 00:19:38,880 --> 00:19:42,330 And this works fine because charging the shot takes a long time. 376 00:19:42,330 --> 00:19:47,640 So just from a practical perspective, it's not going to happen that we don't have any shot energy ready 377 00:19:47,640 --> 00:19:49,320 when our charge shot is ready. 378 00:19:49,320 --> 00:19:55,050 But if you want to be very strict with this, it actually makes more sense to take this, um, control 379 00:19:55,050 --> 00:19:58,710 X and put it inside of the spawned projectile function. 380 00:19:58,710 --> 00:19:59,760 And here. 381 00:20:00,420 --> 00:20:03,420 We can just do the check in here. 382 00:20:03,420 --> 00:20:04,830 Yes, just go here. 383 00:20:06,340 --> 00:20:10,570 And put it in here and we want to check if the shot energy. 384 00:20:11,930 --> 00:20:19,310 Is not bigger anymore, but bigger or equals than the value which we need. 385 00:20:19,310 --> 00:20:25,160 And here we can just again find our projectile class, which tells us like how much energy do we need? 386 00:20:25,160 --> 00:20:31,010 And just check if we have the energy available to even spawn this projectile, because otherwise it's 387 00:20:31,010 --> 00:20:32,270 just not going to spawn it. 388 00:20:32,270 --> 00:20:36,830 And this just makes sure we don't have any bugs where we can, or the user can probably find out some 389 00:20:36,830 --> 00:20:41,510 weird scenario where they would possibly be able to use a charge shot, even if they don't have the 390 00:20:41,510 --> 00:20:42,170 charge. 391 00:20:42,350 --> 00:20:43,940 So go back to the event graph. 392 00:20:43,940 --> 00:20:48,590 And here we can now get rid of this because it is inside of the spawn projectile. 393 00:20:48,590 --> 00:20:52,160 And the good thing is that it is being reused for this now. 394 00:20:52,160 --> 00:20:54,260 And it's also being reused for our completed. 395 00:20:54,260 --> 00:20:57,050 And the is stunned is not really related to the shooting itself. 396 00:20:57,050 --> 00:20:59,540 So I think it's fine to just have it outside here again. 397 00:20:59,960 --> 00:21:05,360 And now's the part where we want to decide if we can shoot the partially charged projectile or the fully 398 00:21:05,360 --> 00:21:06,470 charged projectile. 399 00:21:06,920 --> 00:21:10,310 So we need to decide on the thresholds for the elapsed seconds. 400 00:21:10,990 --> 00:21:15,910 And what I came up with is that below 0.8 we are not going to spawn anything. 401 00:21:16,730 --> 00:21:21,920 If we have more than 0.8 elapsed seconds, we spawn the partially charged projectile, and if we have 402 00:21:21,920 --> 00:21:25,760 more than 1.8 seconds, we spawn the actually fully charged projectile. 403 00:21:25,760 --> 00:21:29,780 And these are very similar values to the actual games we are basing this off of. 404 00:21:30,750 --> 00:21:33,270 And why do we need to have a threshold for spawning? 405 00:21:33,270 --> 00:21:39,690 Nothing, because if we just press the button well, to ourselves, it feels like we're just pressing 406 00:21:39,690 --> 00:21:40,140 the buttons. 407 00:21:40,140 --> 00:21:45,120 But actually we are holding the button for 0.0 something seconds, so we don't want to just spawn two 408 00:21:45,120 --> 00:21:47,550 projectiles if you just press the button very quickly. 409 00:21:48,090 --> 00:21:52,080 So the first thing you want to do here is to have another branch here. 410 00:21:52,690 --> 00:21:54,370 And we just want to check. 411 00:21:55,330 --> 00:21:58,060 If the elapsed time elapsed seconds. 412 00:21:58,060 --> 00:21:59,800 Bigger or equal. 413 00:22:00,700 --> 00:22:02,470 Then our partial charge time. 414 00:22:02,470 --> 00:22:06,010 So 0.8 is our partial charge time. 415 00:22:06,430 --> 00:22:08,890 If this is not the case, then just nothing happens, right? 416 00:22:08,890 --> 00:22:11,050 We don't want to spawn anything if we let go of the button. 417 00:22:11,930 --> 00:22:14,930 And of course we want to turn this into a variable again. 418 00:22:14,930 --> 00:22:15,140 Right. 419 00:22:15,140 --> 00:22:16,100 The 0.8. 420 00:22:16,100 --> 00:22:17,300 Just promote the variable. 421 00:22:17,300 --> 00:22:20,150 And it's called partial charge time. 422 00:22:22,200 --> 00:22:27,870 And let's say in this case, well, if this is the case, first we can just copy and paste this, the 423 00:22:27,870 --> 00:22:33,330 spawn projectile and we just spawn the partial charge projectile. 424 00:22:33,330 --> 00:22:33,900 Right. 425 00:22:33,900 --> 00:22:35,460 So let's just try this out. 426 00:22:35,980 --> 00:22:39,130 I go like this, I just press the button very quickly and let go. 427 00:22:39,160 --> 00:22:41,200 We don't get a partial projectile. 428 00:22:41,200 --> 00:22:45,340 I hold it, I hold it, I hold it, and now we get the partial. 429 00:22:45,340 --> 00:22:45,490 Right. 430 00:22:45,490 --> 00:22:47,080 You can see it's a little bit purple. 431 00:22:47,080 --> 00:22:49,330 If I let go, the color is different. 432 00:22:49,330 --> 00:22:52,720 I let go and you can see the other projectile is spawning. 433 00:22:52,990 --> 00:22:55,570 But of course we need to add one more branch to. 434 00:22:55,570 --> 00:22:56,770 Then again decide. 435 00:22:56,770 --> 00:22:58,690 Well first we pass this threshold. 436 00:22:58,690 --> 00:23:01,360 If did we pass the next threshold. 437 00:23:01,360 --> 00:23:03,850 But this is going to become a little bit complicated. 438 00:23:03,850 --> 00:23:08,320 So we just want to select the branch the spawn projectile and hold control. 439 00:23:08,320 --> 00:23:09,490 Select these as well. 440 00:23:09,490 --> 00:23:11,920 And we just want to collapse this to a function. 441 00:23:12,400 --> 00:23:18,010 Just right click collapse the function and try charge shot. 442 00:23:18,840 --> 00:23:21,690 Like this and just move this up here. 443 00:23:21,690 --> 00:23:27,150 And this is going to be a little bit easier to deal with this and just yeah, make another reroute node. 444 00:23:27,150 --> 00:23:30,810 And I want to change the name here to elapsed time. 445 00:23:31,480 --> 00:23:32,020 Yes. 446 00:23:32,020 --> 00:23:32,380 Okay. 447 00:23:32,380 --> 00:23:34,510 So now we can go in here, compile and save. 448 00:23:34,870 --> 00:23:37,150 And again I want I like shortcutting these. 449 00:23:37,150 --> 00:23:38,470 So I don't like to have these lines here. 450 00:23:38,470 --> 00:23:40,750 Just elapse time just to write it here. 451 00:23:40,780 --> 00:23:41,950 Get the shortcut. 452 00:23:43,330 --> 00:23:49,510 And here, instead of, uh, spawning this projectile, we actually want to add another branch. 453 00:23:49,510 --> 00:23:50,920 So just copy paste this. 454 00:23:52,140 --> 00:23:55,230 And here we check for, well, elapsed time. 455 00:23:55,230 --> 00:23:57,780 Bigger equals then. 456 00:23:58,550 --> 00:24:01,190 And here we have the fully charged time. 457 00:24:01,190 --> 00:24:01,400 Right. 458 00:24:01,400 --> 00:24:03,980 So we need to make another, uh, variable. 459 00:24:03,980 --> 00:24:09,770 But first we can just type in 1.8, which is the value we talked about before for the full charge and 460 00:24:09,770 --> 00:24:11,600 just promote to variable. 461 00:24:11,600 --> 00:24:14,360 And it's called full charge time. 462 00:24:14,810 --> 00:24:17,750 Move this over here a little bit and compile save. 463 00:24:17,750 --> 00:24:19,670 Make sure it is set to 1.8. 464 00:24:19,670 --> 00:24:21,710 Make sure this one is set to 0.8. 465 00:24:21,710 --> 00:24:23,390 Yes this is fine okay. 466 00:24:23,390 --> 00:24:27,440 So if we have the full charge then copy paste. 467 00:24:27,860 --> 00:24:34,400 We want to use the full charge projectile for true and the partial charge projectile right. 468 00:24:34,400 --> 00:24:36,980 The partial charge for false. 469 00:24:37,370 --> 00:24:42,290 And this is just how we can branch and decide between these projectile based on the time which we pass 470 00:24:42,290 --> 00:24:46,490 in here from our IA shoot event and compile and save. 471 00:24:46,490 --> 00:24:47,960 And let's try this out. 472 00:24:47,960 --> 00:24:51,050 I'm holding the button a little bit, I let go, I get the partial charge. 473 00:24:51,050 --> 00:24:52,010 You can see it's purple. 474 00:24:52,010 --> 00:24:56,900 I hold it longer and longer and longer and I let go and I get the full charge. 475 00:24:56,900 --> 00:25:03,200 So this is how you can make a button hold system and do something else based on the elapsed time. 476 00:25:03,880 --> 00:25:08,590 And all of this is just possible because of the enhanced input system, which became the standard with 477 00:25:08,950 --> 00:25:09,670 5.1. 478 00:25:09,700 --> 00:25:13,930 Before this, it would have been a lot more annoying, even more complicated than this. 479 00:25:14,290 --> 00:25:18,520 Of course, the charging doesn't feel good yet because we don't even see if we are charging, right. 480 00:25:18,520 --> 00:25:21,040 Like, I don't even know if I'm still holding the button. 481 00:25:21,040 --> 00:25:26,290 So for that, we are going to implement a sprite flashing, just like when taking damage, but a different 482 00:25:26,290 --> 00:25:28,630 color to actually show that we are charging. 483 00:25:28,630 --> 00:25:30,370 But that's for another lesson. 484 00:25:30,820 --> 00:25:38,800 What I want to do now is that if I get hit while I'm charging, I get hit, and if I let go, I still 485 00:25:38,800 --> 00:25:39,760 get the full charge shot. 486 00:25:39,760 --> 00:25:41,260 But this is not how it should work. 487 00:25:41,260 --> 00:25:45,550 If I get hit, it should actually cancel my charge and it should reset me. 488 00:25:46,170 --> 00:25:50,490 So back in the player we can make a new boolean and just call. 489 00:25:50,490 --> 00:25:54,030 It was hit during charge. 490 00:25:54,980 --> 00:25:56,870 And this should be a boolean, right. 491 00:25:56,870 --> 00:26:00,410 So we can first, uh, compile and save. 492 00:26:01,360 --> 00:26:06,670 And make this a regular a single variable and set this to a boolean. 493 00:26:06,670 --> 00:26:09,280 Compile and save to get the default value. 494 00:26:09,310 --> 00:26:12,010 Default value should be false right when we spawn in. 495 00:26:12,010 --> 00:26:13,060 We don't care about this. 496 00:26:13,060 --> 00:26:16,870 So now we go to the any damage event right on the player. 497 00:26:17,110 --> 00:26:18,730 Uh not constructed event graph. 498 00:26:18,730 --> 00:26:22,300 And if it's hard to find well it's here, but you can also just. 499 00:26:22,300 --> 00:26:23,680 Right any damage. 500 00:26:24,930 --> 00:26:28,260 And it's gonna zap you to the position, right? 501 00:26:28,260 --> 00:26:35,070 So on any damage before we trigger the invincibility we also want to set was hit during charge. 502 00:26:35,740 --> 00:26:36,640 To true. 503 00:26:38,870 --> 00:26:46,250 Like this, and we then want to actually reset this when we press the button again, right? 504 00:26:46,250 --> 00:26:49,010 So whenever we get hit this gets turned to true. 505 00:26:49,010 --> 00:26:52,700 But we need to reset this before we start holding the button again right. 506 00:26:52,700 --> 00:26:53,870 If we are not stunned. 507 00:26:53,870 --> 00:27:00,380 So here I can then just set wotsit during charge to false because we start pressing the button again. 508 00:27:00,380 --> 00:27:02,690 I want to have this be reset. 509 00:27:02,690 --> 00:27:05,870 If we are not stunned, we're not allowed to press this while we are stunned. 510 00:27:05,870 --> 00:27:07,250 And what can I do then? 511 00:27:07,250 --> 00:27:12,560 Well, in try charge shot, I need to put in a check for this. 512 00:27:13,070 --> 00:27:15,620 I can then just go for was hit during charge. 513 00:27:15,980 --> 00:27:18,740 Get was hit during charge, not boolean. 514 00:27:20,370 --> 00:27:22,410 And again put in a branch. 515 00:27:22,890 --> 00:27:27,510 So if we let go while we were hit during a charge, well, it should just do nothing. 516 00:27:27,510 --> 00:27:32,370 So we're going to take the same branch here, just do nothing and I can just compile and save. 517 00:27:32,370 --> 00:27:33,600 So now I charge. 518 00:27:33,600 --> 00:27:37,050 Normally I don't get hit, I let go, we get the charge shot. 519 00:27:37,050 --> 00:27:37,740 It's all good. 520 00:27:37,740 --> 00:27:42,780 I start charging, I hold, I hold, I get hit, I let go, we get nothing. 521 00:27:42,780 --> 00:27:43,080 Right? 522 00:27:43,080 --> 00:27:46,500 So this is what we need for game balance, for game feel. 523 00:27:46,500 --> 00:27:50,670 If you get hit, if you get stunned, it should reset your charge shot. 524 00:27:50,910 --> 00:27:52,770 And congratulations for coming this far. 525 00:27:52,770 --> 00:27:57,780 This was a quite complicated ability to code, but we went over a lot of very important things that 526 00:27:57,780 --> 00:28:03,960 will help you to actually make abilities that are similar by yourself, not just a charge shot, a charged 527 00:28:04,110 --> 00:28:07,020 attack with a sword maybe, or a charge jump. 528 00:28:07,020 --> 00:28:10,080 Like a lot of different things that you can use this pattern for. 529 00:28:10,080 --> 00:28:15,300 And also in most cases you actually want to cancel that action if you get hit. 530 00:28:15,300 --> 00:28:16,770 So you also we looked at the stun. 531 00:28:16,770 --> 00:28:21,030 We looked at how we can reset something if we get hit during the hold action. 532 00:28:21,030 --> 00:28:25,020 But while setting this up, we actually created a lot of new variables and things are starting to get 533 00:28:25,020 --> 00:28:26,070 a little bit unorganized. 534 00:28:26,070 --> 00:28:29,970 So the next lesson is just a very simple lesson on how to clean up variables. 48770

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