All language subtitles for 008 Improving the Slide[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,200 --> 00:00:04,100 In the last episode, we implemented the slide, but there are still a couple of issues and things we 2 00:00:04,100 --> 00:00:05,180 want to polish up. 3 00:00:05,670 --> 00:00:09,270 I can shoot while sliding, which is something I don't want. 4 00:00:09,720 --> 00:00:11,970 I can turn around while sliding. 5 00:00:12,000 --> 00:00:14,640 The momentum doesn't change, but the animation turns around. 6 00:00:14,640 --> 00:00:16,440 The sprite direction turns around. 7 00:00:16,470 --> 00:00:19,530 I want to be able to cancel the slide into a jump. 8 00:00:19,560 --> 00:00:23,370 Well, now we can just kind of jump while we're sliding, but I actually want to cancel the slide if 9 00:00:23,370 --> 00:00:24,180 we jump. 10 00:00:24,180 --> 00:00:27,570 And I also want to cancel the slide if we go off a ledge. 11 00:00:27,990 --> 00:00:31,680 And I also want to cancel the slide if we walk in the opposite direction. 12 00:00:31,860 --> 00:00:36,540 And lastly, I also want to prevent sliding while we are in the air because now we can kind of do this 13 00:00:36,540 --> 00:00:39,330 air dash into the slide, which is kind of fun. 14 00:00:39,330 --> 00:00:43,080 But um, yeah, I want to prevent this to show you how to prevent this. 15 00:00:43,110 --> 00:00:46,200 If you like this, you can just put it back in later. 16 00:00:46,620 --> 00:00:49,260 First off, let's prevent shooting while sliding. 17 00:00:49,260 --> 00:00:50,640 And this is very easy. 18 00:00:50,640 --> 00:00:56,310 So in the BP player I'll just turn off the play mode and we just look for our IA shoot. 19 00:00:57,970 --> 00:00:58,480 Uh, here. 20 00:00:58,480 --> 00:01:00,340 I should go here. 21 00:01:00,550 --> 00:01:05,680 And now we don't just want to check for instant, but we also want to check for is sliding. 22 00:01:05,800 --> 00:01:09,160 Is ground sliding not boolean. 23 00:01:10,640 --> 00:01:11,660 Like this. 24 00:01:11,660 --> 00:01:13,820 And both of these need to be true. 25 00:01:13,820 --> 00:01:16,970 So we are not sliding and we are not stunned. 26 00:01:16,970 --> 00:01:20,270 So yeah add an and boolean here. 27 00:01:21,230 --> 00:01:21,950 Just like this. 28 00:01:24,010 --> 00:01:26,890 And then we also want to do the same for the charge. 29 00:01:26,890 --> 00:01:28,330 Uh, charge shot. 30 00:01:28,330 --> 00:01:28,960 Right. 31 00:01:28,990 --> 00:01:35,530 So here also like open up some space and here we can just delete this and just copy this instead. 32 00:01:35,530 --> 00:01:38,170 Copy paste Ctrl c, Ctrl v. 33 00:01:38,980 --> 00:01:43,120 And use this here and create some space here for the. 34 00:01:44,190 --> 00:01:45,450 These ones. 35 00:01:47,100 --> 00:01:48,690 And you can actually use the arrow keys. 36 00:01:48,690 --> 00:01:52,590 If you select this, just use the arrow keys on the keyboard to move them around. 37 00:01:52,590 --> 00:01:56,880 And this is all we need to make sure that we cannot shoot the regular shot. 38 00:01:56,880 --> 00:01:59,760 And we also cannot shoot the charge shot while we're sliding. 39 00:01:59,850 --> 00:02:00,990 Let's try this out. 40 00:02:00,990 --> 00:02:01,620 Right. 41 00:02:01,620 --> 00:02:04,560 I try to shoot, I can't, I charge a shot. 42 00:02:05,220 --> 00:02:06,930 I let go while I'm sliding. 43 00:02:07,490 --> 00:02:08,600 And also I can shoot. 44 00:02:08,600 --> 00:02:11,120 So this solved the first issue we had. 45 00:02:11,480 --> 00:02:16,220 Next up, let's fix the sprite turning around if we steer against the sliding. 46 00:02:16,220 --> 00:02:18,800 And this is also a very simple solution. 47 00:02:18,800 --> 00:02:26,360 So in the BP player under the move event the IA move right here we have the update rotation. 48 00:02:26,360 --> 00:02:30,380 And here we already added this condition for if we press up and down that nothing happens. 49 00:02:30,380 --> 00:02:33,800 And here we just want to add another condition. 50 00:02:34,160 --> 00:02:36,980 So it is not the up and down input. 51 00:02:37,630 --> 00:02:40,030 And another and Boolean. 52 00:02:41,330 --> 00:02:42,620 And rule in here. 53 00:02:43,240 --> 00:02:45,430 And we are not sliding. 54 00:02:45,430 --> 00:02:49,300 So again get is ground sliding and not boolean. 55 00:02:50,570 --> 00:02:53,570 Not building like this and connect all of this. 56 00:02:56,210 --> 00:02:57,380 Open up some space. 57 00:02:57,590 --> 00:02:58,010 Right. 58 00:02:58,010 --> 00:03:03,830 So now if we are sliding or if we're just pressing up or down, we aren't just we are just not going 59 00:03:03,830 --> 00:03:06,800 to execute our update rotation logic. 60 00:03:06,800 --> 00:03:07,940 So try this again. 61 00:03:07,940 --> 00:03:09,980 Slide and try to steer against it. 62 00:03:09,980 --> 00:03:13,100 And you cannot change the sprite direction right. 63 00:03:13,100 --> 00:03:14,690 Everything else still works the same. 64 00:03:14,690 --> 00:03:16,310 Second problem fixed. 65 00:03:16,640 --> 00:03:22,550 Next problem being able to slide while in the air or doing this kind of air dash. 66 00:03:24,280 --> 00:03:31,450 And for this we can just go to the player and again look for our IA jump, because this is our jump 67 00:03:31,450 --> 00:03:32,020 input. 68 00:03:32,020 --> 00:03:34,210 And what do we do here. 69 00:03:34,210 --> 00:03:37,960 Well we check for is holding down but this is not enough. 70 00:03:37,960 --> 00:03:40,630 We also want to check for is grounded. 71 00:03:41,050 --> 00:03:43,870 So we can just add a another branch before this. 72 00:03:43,870 --> 00:03:47,890 Because actually the jump should also not happen if we're not grounded. 73 00:03:47,890 --> 00:03:50,470 So we can just select all of this. 74 00:03:52,060 --> 00:03:53,890 And move it over to the right. 75 00:03:55,340 --> 00:03:56,210 Like this. 76 00:03:57,090 --> 00:03:57,600 Yes. 77 00:03:57,600 --> 00:04:01,770 And then have a another branch here where you can just go here from falls and branch. 78 00:04:02,780 --> 00:04:05,330 And we can look for. 79 00:04:06,350 --> 00:04:10,280 The, um, is moving on ground, uh, node. 80 00:04:10,280 --> 00:04:15,470 So from the character movement we can just get is moving on ground. 81 00:04:15,470 --> 00:04:18,890 And this basically just tells us are we grounded or not. 82 00:04:18,890 --> 00:04:23,540 So if we are grounded, then we just continue doing our jump or doing our sliding. 83 00:04:23,540 --> 00:04:26,030 All of this is fine. 84 00:04:26,240 --> 00:04:29,570 And if we are not grounded, well, we just don't want to do anything. 85 00:04:29,570 --> 00:04:33,320 We don't want to do anything because the wall jump actually happens on the left side already. 86 00:04:33,320 --> 00:04:35,750 So for this one we don't have the ground check. 87 00:04:35,750 --> 00:04:37,160 So this is fine right. 88 00:04:37,160 --> 00:04:39,470 So let's try this out I can jump. 89 00:04:39,470 --> 00:04:40,580 Jumping works fine. 90 00:04:40,580 --> 00:04:41,810 Sliding works fine. 91 00:04:41,810 --> 00:04:46,760 Wall jumping also still works, but we can now not do the slide while we're in the air. 92 00:04:46,760 --> 00:04:48,830 So we also fixed this problem. 93 00:04:48,830 --> 00:04:51,140 But again I think it's actually a a bug. 94 00:04:51,140 --> 00:04:53,420 That was kind of a fun gameplay mechanic. 95 00:04:53,420 --> 00:04:56,240 So if you like it you could just put it back in later. 96 00:04:56,690 --> 00:05:00,440 Next up, I want to be able to cancel the slide when jumping right. 97 00:05:00,440 --> 00:05:04,910 So now we can kind of jump while sliding, but we just keep on sliding. 98 00:05:04,910 --> 00:05:06,590 And it's kind of awkward. 99 00:05:06,590 --> 00:05:11,600 We just want to completely stop the slide if we press the jump button while sliding. 100 00:05:11,600 --> 00:05:15,650 And again, in the BP player, we are already in a right position right here. 101 00:05:15,650 --> 00:05:22,460 For the Aya jump, we have the uh, here the root motion constant force with callback. 102 00:05:23,270 --> 00:05:25,910 And we can simply use the async action. 103 00:05:25,910 --> 00:05:27,560 And here we call cancel. 104 00:05:28,480 --> 00:05:32,050 Cans like this and it and it automatically connects it to this. 105 00:05:32,050 --> 00:05:36,250 Which is weird because then after it executes it, it's just going to cancel it right away. 106 00:05:36,250 --> 00:05:37,690 So hold alt and click here. 107 00:05:37,690 --> 00:05:42,940 We actually want to call the cancel from jump so we can just connect right here. 108 00:05:42,940 --> 00:05:46,240 This doesn't look nice, but I just want to show you that this actually works. 109 00:05:46,240 --> 00:05:47,710 So we can just do this. 110 00:05:48,470 --> 00:05:50,450 And it cancels the slide. 111 00:05:50,450 --> 00:05:55,040 The animation is still playing, which is another issue, but a functionally it works. 112 00:05:55,040 --> 00:06:01,010 So here after we cancel, we also just want to copy paste this and just um, set this ground slider 113 00:06:01,040 --> 00:06:01,850 to false. 114 00:06:01,850 --> 00:06:03,440 And now let's have a look at this. 115 00:06:03,440 --> 00:06:04,070 Right. 116 00:06:04,070 --> 00:06:08,000 I can cancel the slide now into jumping. 117 00:06:08,000 --> 00:06:13,670 And again this is just very good for precise platforming to give the player control. 118 00:06:13,670 --> 00:06:15,530 Because now we can do actions like this right. 119 00:06:15,530 --> 00:06:17,240 You can slide jump shoot. 120 00:06:17,240 --> 00:06:21,080 And it just makes the game feel very snappy and responsive. 121 00:06:21,380 --> 00:06:23,300 And even this canceling now worked. 122 00:06:23,300 --> 00:06:27,410 It is actually not nice to just connect the node from jumping all the way up here. 123 00:06:27,410 --> 00:06:32,930 And there's also going to be other places where we want to cancel the slide, for example, if we take 124 00:06:32,930 --> 00:06:33,680 damage. 125 00:06:33,680 --> 00:06:39,800 So an easy way to just create shortcuts to this cancel is to just here right click Custom Event and 126 00:06:39,800 --> 00:06:42,980 called Cancel Slide like this. 127 00:06:42,980 --> 00:06:45,950 And we just connect here and disconnect this one. 128 00:06:45,950 --> 00:06:47,180 Hold alt left click. 129 00:06:47,180 --> 00:06:49,370 And now this is a custom event. 130 00:06:49,370 --> 00:06:51,650 We can just call it here from the jump. 131 00:06:51,650 --> 00:06:54,110 And here we can just call Cancel slide. 132 00:06:54,110 --> 00:06:54,560 Right. 133 00:06:54,560 --> 00:06:58,640 So it's going to basically shortcut us to this event and call the cancel. 134 00:06:58,640 --> 00:07:01,700 And just to show you that this still works we can do this. 135 00:07:02,310 --> 00:07:03,240 Like this. 136 00:07:03,630 --> 00:07:09,090 One problem with this, though, is if I try to only jump, I'm not going to slide. 137 00:07:09,090 --> 00:07:12,900 I'm only going to jump and I exit out, press escape. 138 00:07:12,900 --> 00:07:14,400 We get an error message. 139 00:07:14,850 --> 00:07:16,500 And this is because. 140 00:07:17,670 --> 00:07:24,300 Even if we don't have an active instance of this, uh, root motion, constant forces, we still try 141 00:07:24,300 --> 00:07:30,900 to call an async action cancel on something that doesn't exist, because this only exists after we call 142 00:07:30,900 --> 00:07:31,710 the slide. 143 00:07:31,710 --> 00:07:37,050 But here we simply call cancel slide from the jumping without having ever called the slide before. 144 00:07:37,050 --> 00:07:37,260 Right. 145 00:07:37,260 --> 00:07:38,490 So this is null. 146 00:07:38,490 --> 00:07:40,530 So we need to add an is valid. 147 00:07:40,530 --> 00:07:41,460 Check here. 148 00:07:41,910 --> 00:07:45,030 The bottom one with the question mark right is valid. 149 00:07:46,350 --> 00:07:47,610 And again it connects it here. 150 00:07:47,610 --> 00:07:48,900 We don't want to connect it here. 151 00:07:48,900 --> 00:07:53,100 We want to connect it to the cancel slide here right like this. 152 00:07:53,430 --> 00:08:00,120 And only if this is valid then we actually want to go through with the canceling and just rearrange 153 00:08:00,120 --> 00:08:00,630 these nodes. 154 00:08:00,630 --> 00:08:06,000 Here I want to double click here create a reroute node like this. 155 00:08:08,090 --> 00:08:10,400 And now we can also just reuse this one here. 156 00:08:10,400 --> 00:08:11,300 This is fine. 157 00:08:12,590 --> 00:08:14,600 This and create some space. 158 00:08:16,550 --> 00:08:17,060 And yes. 159 00:08:17,060 --> 00:08:19,280 So now this is just again a safety net. 160 00:08:19,890 --> 00:08:24,030 So if I do it now and I try to just jump, I'm not going to slide. 161 00:08:24,030 --> 00:08:24,840 Just jump. 162 00:08:25,520 --> 00:08:27,710 We actually don't get an error message. 163 00:08:27,710 --> 00:08:29,780 And if I slide and jump, it works. 164 00:08:29,780 --> 00:08:37,039 So this prevents us from calling this sorry, calling this cancel on a not available async action. 165 00:08:37,039 --> 00:08:41,840 And now that we prepared an easy way for us to call the cancel slide, we actually want to cancel it 166 00:08:41,840 --> 00:08:43,370 when we take damage. 167 00:08:43,370 --> 00:08:48,920 Because now if we go up here and we slide into the crab, we actually get knocked forward because the 168 00:08:48,920 --> 00:08:50,180 slide is still active. 169 00:08:50,180 --> 00:08:51,830 We actually don't get knocked back. 170 00:08:51,830 --> 00:08:52,700 So let's do that. 171 00:08:52,700 --> 00:08:56,600 Now in the BP player, we just want to look for any damage. 172 00:08:56,600 --> 00:08:58,520 We can just right click any damage. 173 00:08:58,520 --> 00:09:02,150 And if it already exists it's just going to teleport us there. 174 00:09:02,300 --> 00:09:08,060 And now here for the any damage event we have all of our well the was set during charge, the trigger 175 00:09:08,060 --> 00:09:11,540 invincibility and we have our entire knockback logic. 176 00:09:11,540 --> 00:09:16,460 But let's just collapse the knockback logic for now because it's a very large and it's kind of hard 177 00:09:16,460 --> 00:09:17,510 to understand what's happening here. 178 00:09:17,510 --> 00:09:21,680 Just select all of this all the way up here, not the trigger invincibility. 179 00:09:21,680 --> 00:09:24,440 Hold control and get these two nodes as well. 180 00:09:24,440 --> 00:09:24,650 Right. 181 00:09:24,650 --> 00:09:29,720 So everything that is related to the knockback and we can just right click collapse nodes. 182 00:09:29,720 --> 00:09:35,570 We cannot collapse the function because we have delays in here and just call it knockback. 183 00:09:36,670 --> 00:09:39,190 Actually, I think I just did two comments. 184 00:09:39,190 --> 00:09:43,300 And this is a problem if the node is outside of the screen, if you try to rename it, it often doesn't 185 00:09:43,300 --> 00:09:44,080 really work. 186 00:09:44,080 --> 00:09:45,460 So knockback. 187 00:09:46,040 --> 00:09:48,140 And just drag this over to the left side. 188 00:09:50,110 --> 00:09:52,540 And here we can double click. 189 00:09:53,420 --> 00:09:54,650 Do it like this. 190 00:09:54,650 --> 00:09:56,780 And self is a little bit weird here. 191 00:09:56,780 --> 00:10:01,760 So actually you want to rename the self to damage causer like this. 192 00:10:02,750 --> 00:10:03,680 And here. 193 00:10:04,580 --> 00:10:06,830 And yeah, compound save, no errors. 194 00:10:06,830 --> 00:10:08,330 Everything here still works. 195 00:10:08,330 --> 00:10:12,380 It's just a little bit easier to understand what's happening here now. 196 00:10:12,380 --> 00:10:14,570 Any damage to find this again. 197 00:10:14,570 --> 00:10:15,110 Right. 198 00:10:15,110 --> 00:10:21,230 So before we do the knockback very important we want to cancel this light before we do the knockback. 199 00:10:21,230 --> 00:10:25,310 Because if we try to cancel it after they're kind of still fighting against each other. 200 00:10:25,310 --> 00:10:27,500 So actually this is the first thing we can do. 201 00:10:27,500 --> 00:10:30,530 So before trigger invincibility, charge and everything. 202 00:10:30,530 --> 00:10:32,690 Let's just cancel the slide first. 203 00:10:32,690 --> 00:10:37,040 So here after any damage from the parent we can just cancel the slide. 204 00:10:40,470 --> 00:10:43,800 Now we can just compile and save this and go here. 205 00:10:43,830 --> 00:10:44,400 Right. 206 00:10:44,400 --> 00:10:45,030 This still works. 207 00:10:45,030 --> 00:10:45,630 This is fine. 208 00:10:45,630 --> 00:10:48,240 And I get hit and it is fine. 209 00:10:48,240 --> 00:10:49,770 The slide is being cancelled. 210 00:10:49,770 --> 00:10:52,620 We get knocked back properly, we get the invincibility. 211 00:10:52,620 --> 00:10:54,180 And even from the right side, right. 212 00:10:54,180 --> 00:10:56,220 I jump in here, I get knocked back properly. 213 00:10:56,220 --> 00:11:00,570 This is working fine now, but we still have a couple of things left. 214 00:11:00,570 --> 00:11:00,870 Right. 215 00:11:00,870 --> 00:11:02,700 The next thing we want to do is to. 216 00:11:02,880 --> 00:11:08,730 Let's just shoot this guy to cancel the slide when going off a ledge, because now we just keep on sliding, 217 00:11:08,730 --> 00:11:12,210 which would be fine, which you could do if you want that in your game. 218 00:11:12,210 --> 00:11:16,830 But again, we want to kind of mimic the Megaman genre of games. 219 00:11:16,830 --> 00:11:20,430 So there it's customary to just cancel the slide when going off a ledge. 220 00:11:20,430 --> 00:11:24,660 And here we have in the BP player an override which we can use. 221 00:11:24,660 --> 00:11:31,200 So for the functions there's overrides and we have the on walking off ledge override, we can just click 222 00:11:31,200 --> 00:11:31,620 it. 223 00:11:31,620 --> 00:11:35,280 And this is something that's available on the character that is being checked for. 224 00:11:35,280 --> 00:11:38,010 And we can just hook into it and make use of it. 225 00:11:38,010 --> 00:11:39,240 And this is super simple. 226 00:11:39,240 --> 00:11:41,010 We can just drag off here. 227 00:11:41,010 --> 00:11:42,180 Cancel slide. 228 00:11:43,360 --> 00:11:46,300 We don't care about the vectors and float that we get here. 229 00:11:46,300 --> 00:11:49,210 We simply want to just look for the event and cancel the slide. 230 00:11:49,210 --> 00:11:49,840 Very easy right? 231 00:11:49,840 --> 00:11:50,860 Compile and save. 232 00:11:50,890 --> 00:11:53,020 Go in here, try the same thing again. 233 00:11:53,230 --> 00:11:55,570 And a slide and the slide stops. 234 00:11:55,570 --> 00:11:56,500 Once we're off the ledge. 235 00:11:56,500 --> 00:11:57,040 Right. 236 00:11:57,040 --> 00:11:57,880 Perfect. 237 00:11:57,880 --> 00:12:00,370 The next thing you want to do is to cancel the slide. 238 00:12:00,370 --> 00:12:02,590 If we slide to the left for example. 239 00:12:02,590 --> 00:12:03,880 But hold right. 240 00:12:03,880 --> 00:12:09,370 So these Mega man type of games usually allow you to cancel the slide if you just press in the opposite 241 00:12:09,370 --> 00:12:10,090 direction. 242 00:12:10,090 --> 00:12:12,730 And this is also kind of easy to implement. 243 00:12:13,340 --> 00:12:18,710 To do this, we can actually reuse something we created before with the drywall slide. 244 00:12:18,710 --> 00:12:26,120 Right in here we have the is holding towards the wall and we can just copy all of this, get all of 245 00:12:26,120 --> 00:12:26,960 these things. 246 00:12:27,050 --> 00:12:29,780 Control C to copy we go to the event graph. 247 00:12:29,780 --> 00:12:32,390 We go to tick right event tick. 248 00:12:32,390 --> 00:12:35,870 If you can't find it just right tick and it's going to take you to it. 249 00:12:35,870 --> 00:12:40,190 And after the drywall slide we can just paste this in control V. 250 00:12:40,370 --> 00:12:43,220 And we actually want to just change one thing. 251 00:12:43,220 --> 00:12:45,380 And here we just have to check this one thing. 252 00:12:45,380 --> 00:12:50,900 We don't want to check for bigger than zero, but actually check for smaller than zero. 253 00:12:51,350 --> 00:12:58,130 Because the result we get here is if the direction we move in matches the direction we are inputting, 254 00:12:58,130 --> 00:13:01,130 we are getting a value bigger than zero. 255 00:13:01,970 --> 00:13:07,370 And if they don't match, we get a value smaller than zero, and if they don't match, we actually want 256 00:13:07,370 --> 00:13:08,780 to cancel the slide. 257 00:13:08,780 --> 00:13:12,140 So we can just go here and here you have a branch. 258 00:13:13,160 --> 00:13:17,390 And here cancel slide and we have to check on tick. 259 00:13:17,390 --> 00:13:19,880 But actually we don't have to always check. 260 00:13:19,880 --> 00:13:23,870 We only have to check for this if we are sliding right. 261 00:13:23,870 --> 00:13:30,050 So here we can get is sliding is ground sliding and have an and boolean. 262 00:13:31,050 --> 00:13:32,040 Like this. 263 00:13:33,250 --> 00:13:41,230 So if we are sliding and this is the case, then, uh, here, then we want to cancel the slide. 264 00:13:43,590 --> 00:13:46,650 And there's a nice thing with the and operators like this. 265 00:13:47,270 --> 00:13:49,820 If the first one is false, it will actually shortcut. 266 00:13:49,820 --> 00:13:51,710 And it's not even going to evaluate this one. 267 00:13:51,710 --> 00:13:53,450 And we're already going to shortcut to false. 268 00:13:53,450 --> 00:13:58,040 So we're not going to waste any resources on checking this if we aren't ground sliding. 269 00:13:58,040 --> 00:13:58,550 Right. 270 00:13:58,550 --> 00:14:00,590 But if this is true then it's going to check. 271 00:14:00,590 --> 00:14:01,940 Is this one also true? 272 00:14:01,940 --> 00:14:03,440 And only if they're both true. 273 00:14:03,440 --> 00:14:05,630 Then we are going to cancel the slide. 274 00:14:05,630 --> 00:14:06,890 And this is not an Unreal Engine thing. 275 00:14:06,890 --> 00:14:12,320 This is just a general programming thing that optimizes and booleans or booleans. 276 00:14:14,540 --> 00:14:16,790 And of course, now we just want to collapse this. 277 00:14:16,790 --> 00:14:19,430 And here we can just select all of this. 278 00:14:20,220 --> 00:14:24,300 And here we don't have any delays, so we can also collapse the nodes, but we can also collapse the 279 00:14:24,300 --> 00:14:25,020 function. 280 00:14:25,020 --> 00:14:28,020 And it's called try cancel slide. 281 00:14:28,730 --> 00:14:32,210 And move it over to the side and look into it. 282 00:14:32,210 --> 00:14:32,810 Right. 283 00:14:32,810 --> 00:14:37,940 So we just have encapsulated this nice little function and let's try it out. 284 00:14:38,330 --> 00:14:39,710 So I'm going to slide. 285 00:14:40,160 --> 00:14:43,250 And while I slide I'm going to press the opposite direction. 286 00:14:43,730 --> 00:14:45,920 If I press the same direction nothing happens. 287 00:14:45,950 --> 00:14:49,880 If I press the opposite I can just kind of cancel the slide. 288 00:14:49,880 --> 00:14:52,370 And again this is good for precision platforming, right? 289 00:14:52,370 --> 00:14:57,290 Because I could like slide towards a ledge and then just, oh, I don't want to go over the ledge. 290 00:14:57,290 --> 00:15:01,340 And I just kind of, uh, hold in the opposite direction. 291 00:15:04,090 --> 00:15:07,840 And this is just a nice little thing for precision platformer games. 292 00:15:07,840 --> 00:15:10,510 And now there's only one last thing we want to take care of. 293 00:15:10,510 --> 00:15:17,770 And this is if we press slide multiple times, it actually kind of bugs out because we slide again while 294 00:15:17,770 --> 00:15:19,120 we are still sliding. 295 00:15:19,120 --> 00:15:23,650 We actually want to make sure that we can only slide if we aren't already sliding. 296 00:15:23,650 --> 00:15:27,400 So this is another small branch condition we have to input. 297 00:15:27,400 --> 00:15:31,630 So in the BP player again we want to look for our IA jump. 298 00:15:32,140 --> 00:15:34,240 And here we have the Is wall sliding. 299 00:15:34,240 --> 00:15:35,770 We have the IA move. 300 00:15:35,770 --> 00:15:39,100 And here we try to actually jump right a slide. 301 00:15:39,100 --> 00:15:39,550 Sorry. 302 00:15:39,550 --> 00:15:41,830 Here is our actual slide logic. 303 00:15:42,190 --> 00:15:46,810 And we can just put this over here and just add a branch here. 304 00:15:47,360 --> 00:15:48,410 Branch. 305 00:15:49,090 --> 00:15:53,620 And we get the is ground sliding, not boolean. 306 00:15:55,420 --> 00:15:56,710 And put this in here. 307 00:15:57,190 --> 00:15:58,030 Like this. 308 00:16:00,180 --> 00:16:02,460 And just open up some more space. 309 00:16:05,140 --> 00:16:05,320 It. 310 00:16:05,320 --> 00:16:06,520 Q here to align them. 311 00:16:06,520 --> 00:16:06,970 Right? 312 00:16:06,970 --> 00:16:10,480 So now we can only slide if we aren't already sliding. 313 00:16:10,480 --> 00:16:12,670 And again this is a very common pattern, right. 314 00:16:12,670 --> 00:16:16,150 You check if you can do something then you set that you are doing it. 315 00:16:16,150 --> 00:16:19,450 And then after the action is over you allow doing it again. 316 00:16:19,450 --> 00:16:22,150 This is kind of like a cool down in a sense. 317 00:16:22,150 --> 00:16:23,740 And we can just compile and save. 318 00:16:25,300 --> 00:16:26,290 Go to the map. 319 00:16:26,290 --> 00:16:31,030 I'll try to just hammer sliding, but now we don't get this weird bug where you can just slide multiple 320 00:16:31,030 --> 00:16:31,720 times. 321 00:16:31,720 --> 00:16:34,630 We can only slide if the slide is over now. 322 00:16:36,110 --> 00:16:37,130 Just like this. 323 00:16:37,130 --> 00:16:39,530 And this lesson was a lot to take in. 324 00:16:39,530 --> 00:16:42,650 But this is real game development, right? 325 00:16:42,650 --> 00:16:45,080 You're gonna implement a new feature, the feature itself. 326 00:16:45,080 --> 00:16:46,700 It feels kind of easy to implement. 327 00:16:46,700 --> 00:16:51,470 And then you start noticing that there's so many edge cases you have to handle that maybe it starts 328 00:16:51,470 --> 00:16:55,670 fighting with some of your old systems, and you have to make sure that it works together in harmony 329 00:16:55,670 --> 00:16:57,110 with all of your other systems. 330 00:16:57,110 --> 00:17:01,250 And so even if this lesson might have been a little bit annoying, a little bit confusing, this is 331 00:17:01,250 --> 00:17:02,750 real game development. 332 00:17:02,750 --> 00:17:05,660 And you're going to face problems like this all the time. 333 00:17:06,079 --> 00:17:07,160 But congratulations. 334 00:17:07,160 --> 00:17:08,480 This is a huge step. 335 00:17:08,480 --> 00:17:14,030 The slide ability is kind of complicated, and all of the edge cases we took care of are also a good 336 00:17:14,030 --> 00:17:15,410 learning experience. 337 00:17:15,410 --> 00:17:19,069 And in the next lesson we're going to talk about respawning the player if it is defeated. 29088

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