All language subtitles for 03. Player Movement

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 Download
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
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,512 --> 00:00:01,280 Let's out 2 00:00:01,536 --> 00:00:03,072 Script to our play 3 00:00:03,584 --> 00:00:04,864 So I'm going to do is 4 00:00:05,120 --> 00:00:07,680 Is click on the route player mode 5 00:00:07,936 --> 00:00:08,704 And then 6 00:00:08,960 --> 00:00:10,496 I'm going to click the screen 7 00:00:11,520 --> 00:00:12,032 Plus 8 00:00:12,544 --> 00:00:16,128 Which says attach a new or existing Script To The 9 00:00:16,384 --> 00:00:18,176 So go ahead and click that 10 00:00:18,432 --> 00:00:19,968 And this is going to have bye 11 00:00:20,224 --> 00:00:20,736 Play fault 12 00:00:20,992 --> 00:00:21,760 Templates 13 00:00:22,016 --> 00:00:22,784 But we don't 14 00:00:23,296 --> 00:00:24,832 So go ahead and 15 00:00:25,344 --> 00:00:26,624 Select instead 16 00:00:26,880 --> 00:00:27,392 No 17 00:00:27,648 --> 00:00:28,672 Default 18 00:00:28,928 --> 00:00:33,024 And then your past should be the same path as your player seen 19 00:00:33,280 --> 00:00:34,560 So was all the set 20 00:00:34,816 --> 00:00:35,584 Quick create 21 00:00:35,840 --> 00:00:37,120 And that sets us up 22 00:00:37,376 --> 00:00:38,144 With 23 00:00:38,400 --> 00:00:40,448 Very basic script that we can start 24 00:00:41,216 --> 00:00:44,032 So again I'm not going to go over the basic 25 00:00:44,288 --> 00:00:46,080 Programming but I will explain to 26 00:00:46,336 --> 00:00:47,104 A bit about 27 00:00:47,616 --> 00:00:48,384 Kiddle 28 00:00:49,152 --> 00:00:50,176 So the Rain Man 29 00:00:50,688 --> 00:00:51,456 Is cold 30 00:00:51,712 --> 00:00:54,016 When the Node becomes ready in the sea 31 00:00:54,528 --> 00:00:56,832 And the way this works is that the Node 32 00:00:57,088 --> 00:00:58,624 Furthest down the tree 33 00:00:59,136 --> 00:00:59,904 Becomes red 34 00:01:00,123 --> 00:01:02,875 Subtitled by online-courses.club We compress knowledge for you! 35 00:01:02,876 --> 00:01:02,464 And it's Perry 36 00:01:02,720 --> 00:01:04,000 Only becomes ready 37 00:01:04,256 --> 00:01:06,048 When it's parents children all day 38 00:01:06,304 --> 00:01:06,816 Ready 39 00:01:07,072 --> 00:01:08,096 And ready is 40 00:01:08,608 --> 00:01:10,656 A moment in life cycle 41 00:01:10,912 --> 00:01:12,704 Where it's indicated that 42 00:01:12,960 --> 00:01:13,728 The note 43 00:01:13,984 --> 00:01:15,008 In the scene tree 44 00:01:15,520 --> 00:01:17,056 And everything is red 45 00:01:17,312 --> 00:01:17,824 To use 46 00:01:18,080 --> 00:01:18,848 So an artist 47 00:01:19,360 --> 00:01:21,152 If we had a script attached to collision 48 00:01:22,176 --> 00:01:23,200 This will become rare 49 00:01:23,712 --> 00:01:26,272 And then the spray 2D would become ready 50 00:01:26,528 --> 00:01:29,344 And then once both of these are ready then the player becomes 51 00:01:29,856 --> 00:01:30,880 So what does means 52 00:01:31,136 --> 00:01:32,928 Any kodi running the ready method 53 00:01:33,184 --> 00:01:36,000 Memes that your children are already too 54 00:01:36,768 --> 00:01:37,792 The process method 55 00:01:38,048 --> 00:01:42,656 Is a function that gets called every single frame as indicated by 56 00:01:42,912 --> 00:01:43,680 The comment 57 00:01:44,192 --> 00:01:48,032 And delta is passed in which is the amount of time since the previous three 58 00:01:48,544 --> 00:01:50,848 So this is how you can do movement in 59 00:01:51,104 --> 00:01:51,616 A time B 60 00:01:51,872 --> 00:01:52,384 Calculator 61 00:01:52,896 --> 00:01:55,456 Ok before we write any code we need to set 62 00:01:55,712 --> 00:01:57,760 An input map so that we can use 63 00:01:58,016 --> 00:01:59,808 Wasd or arrow 64 00:02:00,576 --> 00:02:01,344 Remove the play 65 00:02:01,600 --> 00:02:03,904 So let's go ahead and go to Prodigy 66 00:02:04,160 --> 00:02:05,440 The top project set 67 00:02:05,952 --> 00:02:06,976 Go to the input 68 00:02:07,232 --> 00:02:10,304 Tab this little toggle show building 69 00:02:11,072 --> 00:02:14,656 It was already a bunch of preconfigured actions here mostly relay 70 00:02:14,912 --> 00:02:15,936 The 2UA 71 00:02:17,472 --> 00:02:20,288 Title designs you can see how this is going to 72 00:02:20,800 --> 00:02:22,592 So all these UI actions 73 00:02:22,848 --> 00:02:25,408 Are available for you to use if you want 74 00:02:25,664 --> 00:02:27,200 Don't work I can figure out 75 00:02:27,712 --> 00:02:29,248 You can go ahead and talk about that back off 76 00:02:29,504 --> 00:02:33,600 I know what we're gonna do is we're going to type into this add new action 77 00:02:34,112 --> 00:02:35,136 We're going to type in 78 00:02:35,904 --> 00:02:36,416 Move 79 00:02:36,672 --> 00:02:37,184 Left 80 00:02:37,440 --> 00:02:38,976 Go ahead and hit enter to add 81 00:02:39,232 --> 00:02:41,792 Let's do another one move underscore 82 00:02:42,304 --> 00:02:43,840 And you probably know that working 83 00:02:44,096 --> 00:02:45,632 How to do move up and move 84 00:02:46,400 --> 00:02:47,168 So Angela 85 00:02:47,424 --> 00:02:48,192 Borax 86 00:02:48,704 --> 00:02:50,240 And now the weight of the input 87 00:02:50,496 --> 00:02:51,264 Artworks is 88 00:02:51,776 --> 00:02:52,288 You 89 00:02:52,544 --> 00:02:54,080 Add an action with the name 90 00:02:54,336 --> 00:02:55,872 And then using the plus 91 00:02:56,384 --> 00:02:57,408 You can add 92 00:02:57,664 --> 00:03:01,248 Any input events you want and as many as you 93 00:03:01,504 --> 00:03:02,272 Under that are 94 00:03:04,064 --> 00:03:06,368 The code but basically will just be able to ask 95 00:03:06,880 --> 00:03:07,904 What is the moves 96 00:03:08,160 --> 00:03:08,672 Action 97 00:03:09,952 --> 00:03:11,232 And that will return true 98 00:03:11,488 --> 00:03:13,536 If any of the events under me 99 00:03:14,304 --> 00:03:14,816 Happened 100 00:03:15,072 --> 00:03:16,608 So we're going to do that now so 101 00:03:16,864 --> 00:03:19,168 Clicking the + button to the right of moves 102 00:03:19,680 --> 00:03:21,216 And we see this 103 00:03:21,472 --> 00:03:21,984 Dial 104 00:03:22,496 --> 00:03:24,288 So we've got a couple of different things we can do 105 00:03:24,544 --> 00:03:26,080 We've got joy pad access 106 00:03:26,592 --> 00:03:27,616 Joypad button 107 00:03:28,128 --> 00:03:29,408 Mouse buttons and 108 00:03:29,664 --> 00:03:30,432 Keyboard keys 109 00:03:30,944 --> 00:03:33,504 What is going to be doing mouse and keyboard for this course 110 00:03:33,760 --> 00:03:35,296 So what we can do as we can 111 00:03:35,808 --> 00:03:37,344 Filter by event 112 00:03:37,856 --> 00:03:39,136 And when we click on this 113 00:03:39,648 --> 00:03:42,464 Field we can actually just press a button on a keyboard 114 00:03:42,976 --> 00:03:43,488 You get 115 00:03:43,744 --> 00:03:44,256 The Intern 116 00:03:44,512 --> 00:03:45,792 So I'm going to click 117 00:03:46,048 --> 00:03:47,072 And once I'm done 118 00:03:47,584 --> 00:03:48,864 I get a bunch of additional 119 00:03:49,120 --> 00:03:52,704 Is here I can check any of these modifier keys if I want 120 00:03:52,960 --> 00:03:56,288 And we have a drop down here that allows us to choose how the 121 00:03:56,544 --> 00:03:57,824 Keycode is 122 00:03:58,080 --> 00:03:58,592 Determined 123 00:03:58,848 --> 00:04:01,664 Just going to keep it as physical key code for now 124 00:04:01,920 --> 00:04:02,944 And click 125 00:04:03,456 --> 00:04:04,480 Click the plus 126 00:04:04,736 --> 00:04:05,248 And again 127 00:04:05,504 --> 00:04:07,552 And we're going to press the lead 128 00:04:07,808 --> 00:04:08,320 Carol 129 00:04:08,832 --> 00:04:09,344 And then click 130 00:04:09,856 --> 00:04:12,672 So now what we've done this we've said move left 131 00:04:12,928 --> 00:04:13,696 Will Now work 132 00:04:13,952 --> 00:04:16,512 For either the achy or the left arrow 133 00:04:17,024 --> 00:04:20,351 So any control scheme that a player wants to use work 134 00:04:20,863 --> 00:04:22,655 I'm going to do the same for me 135 00:04:23,423 --> 00:04:23,935 D 136 00:04:24,191 --> 00:04:24,959 And then we're going to 137 00:04:25,471 --> 00:04:25,983 Right 138 00:04:26,239 --> 00:04:27,263 And the same for 139 00:04:27,519 --> 00:04:29,567 So add a new event press w 140 00:04:29,823 --> 00:04:30,335 Ok 141 00:04:30,591 --> 00:04:31,359 Add a new event 142 00:04:31,615 --> 00:04:32,127 Press up 143 00:04:32,895 --> 00:04:33,407 Ok 144 00:04:33,663 --> 00:04:34,687 And the same for 145 00:04:34,943 --> 00:04:35,711 So 146 00:04:36,223 --> 00:04:36,735 And 147 00:04:37,503 --> 00:04:40,063 This is what your action map should look 148 00:04:40,575 --> 00:04:42,111 Alright go ahead and click close 149 00:04:42,367 --> 00:04:44,159 Now we can go back to our place 150 00:04:44,671 --> 00:04:47,999 So what we want to do is we want to get the direction of the player should move 151 00:04:48,255 --> 00:04:49,023 But then I have to be 152 00:04:49,279 --> 00:04:49,791 On 153 00:04:50,047 --> 00:04:51,071 Inputs that 154 00:04:51,327 --> 00:04:51,839 Where is giving 155 00:04:52,095 --> 00:04:54,143 So go ahead and add to new line 156 00:04:54,399 --> 00:04:55,935 Underneath the 157 00:04:56,191 --> 00:04:58,495 Process to define in new funk 158 00:04:58,751 --> 00:05:00,031 And this is going to be cold again 159 00:05:00,543 --> 00:05:01,055 Moves 160 00:05:01,311 --> 00:05:01,823 Vector 161 00:05:02,591 --> 00:05:04,639 So this is how you define a new function in 162 00:05:04,895 --> 00:05:05,663 Gdscript 163 00:05:05,919 --> 00:05:07,455 You specify the function with 164 00:05:07,711 --> 00:05:08,223 And then 165 00:05:08,479 --> 00:05:10,527 It's recommended to use snake case 166 00:05:11,039 --> 00:05:12,575 Or your function name 167 00:05:12,831 --> 00:05:14,367 Can you put a colon at the end 168 00:05:14,623 --> 00:05:16,927 And if your function doesn't have a body 169 00:05:17,183 --> 00:05:18,975 You can write pass just as the 170 00:05:19,231 --> 00:05:21,791 Do you appear so all the errors and 171 00:05:22,047 --> 00:05:22,815 Go away 172 00:05:23,071 --> 00:05:24,607 I'm going to do is I'm going to rain 173 00:05:24,863 --> 00:05:25,375 Bar 174 00:05:25,631 --> 00:05:26,143 Movie 175 00:05:26,399 --> 00:05:26,911 Vector 176 00:05:27,679 --> 00:05:28,191 Zeke 177 00:05:28,959 --> 00:05:29,727 Vector 178 00:05:31,519 --> 00:05:36,383 What is I doing that setting our moving vector to a 0-0 179 00:05:36,639 --> 00:05:37,407 Select a vector 180 00:05:37,663 --> 00:05:38,943 With a 0 component 181 00:05:39,199 --> 00:05:39,711 In a while 182 00:05:40,223 --> 00:05:42,527 And then I'm just going to save return move 183 00:05:43,039 --> 00:05:43,551 Vector 184 00:05:43,807 --> 00:05:44,319 And again 185 00:05:44,831 --> 00:05:48,159 It's recommended to name your variables with 186 00:05:48,415 --> 00:05:48,927 Snake case 187 00:05:49,183 --> 00:05:50,719 No this isn't doing it 188 00:05:50,975 --> 00:05:53,791 Sing I'll be asleep so we actually need to fill in this bar 189 00:05:54,303 --> 00:05:56,351 And what I'm going to do as I'm going to save our 190 00:05:56,607 --> 00:05:57,887 X movement 191 00:05:58,143 --> 00:05:59,167 Is equal to 192 00:05:59,679 --> 00:06:00,191 Input 193 00:06:00,703 --> 00:06:01,215 Dart 194 00:06:01,471 --> 00:06:01,983 Get 195 00:06:02,239 --> 00:06:03,519 Action 196 00:06:04,799 --> 00:06:07,359 Definitely use the autocomplete so 197 00:06:07,615 --> 00:06:08,639 Action string 198 00:06:08,895 --> 00:06:11,455 You can find it in the list using the app 199 00:06:11,711 --> 00:06:13,247 And down arrow keys 200 00:06:13,503 --> 00:06:14,783 Enter to autofill 201 00:06:15,295 --> 00:06:21,439 And the nice thing about good L4 and get a generally is that it will detect what your actions are actually offer them as a 202 00:06:21,695 --> 00:06:22,207 Spell complete 203 00:06:22,463 --> 00:06:22,975 Suggest 204 00:06:23,487 --> 00:06:25,279 So we're going to put in moves 205 00:06:25,535 --> 00:06:28,351 Here and then we're going to subtract that from 206 00:06:28,607 --> 00:06:29,631 Input 207 00:06:29,887 --> 00:06:31,167 Get action strength 208 00:06:33,983 --> 00:06:34,495 Move 209 00:06:34,751 --> 00:06:35,263 Left 210 00:06:37,311 --> 00:06:38,335 Salami maker 211 00:06:38,591 --> 00:06:39,359 Edinburgh live 212 00:06:39,615 --> 00:06:40,127 Bigger here 213 00:06:40,383 --> 00:06:42,175 Stop what is this line doing 214 00:06:42,431 --> 00:06:44,479 This input jet action Street 215 00:06:44,735 --> 00:06:46,783 Returns an action string 216 00:06:47,039 --> 00:06:48,831 Honour 0 to 1 scale 217 00:06:49,343 --> 00:06:52,159 Now with a keyboard it's a binary state 218 00:06:52,415 --> 00:06:54,719 The key is either pressed or it's not 219 00:06:54,975 --> 00:06:58,559 So this is always going to return zero or 220 00:06:58,815 --> 00:06:59,327 1 221 00:06:59,583 --> 00:07:00,095 However 222 00:07:00,351 --> 00:07:01,119 If you're using 223 00:07:01,375 --> 00:07:02,655 What's a a Joyce 224 00:07:04,191 --> 00:07:05,215 That will return 225 00:07:05,471 --> 00:07:07,775 A fraction or a decimal number 226 00:07:08,031 --> 00:07:09,311 In between 0 and 1 227 00:07:09,567 --> 00:07:10,591 Based on how far 228 00:07:10,847 --> 00:07:11,615 You've pressed the sticker 229 00:07:11,871 --> 00:07:14,943 Again when I come in to get into that in this course but this is 230 00:07:15,967 --> 00:07:16,479 Does 231 00:07:16,735 --> 00:07:18,271 And it's get actions 232 00:07:18,527 --> 00:07:21,599 Here we'll return 1 if we press right 233 00:07:21,855 --> 00:07:25,183 Was some tracking that from the get action strength of moves left 234 00:07:25,439 --> 00:07:25,951 Which is 235 00:07:26,463 --> 00:07:27,743 1 if left is 236 00:07:28,255 --> 00:07:29,791 So what we're going to end up with 237 00:07:30,047 --> 00:07:30,559 If 238 00:07:30,815 --> 00:07:32,351 Moveright is not press 239 00:07:32,607 --> 00:07:35,935 And move left is pressed then RX movement is going to 240 00:07:36,191 --> 00:07:36,703 Negative 241 00:07:37,215 --> 00:07:41,823 If right is pressed and left is not pressed then we're going to get one 242 00:07:42,079 --> 00:07:43,359 Both of them oppress 243 00:07:43,615 --> 00:07:44,895 We're going to get 0 244 00:07:45,151 --> 00:07:49,503 X movement is basically telling us which direction we want to move the player in 245 00:07:49,759 --> 00:07:53,599 And we're going to do the same for a while movement so create another variable called why me 246 00:07:54,367 --> 00:07:58,463 And this is going to be the same exact thing basically someone to copy this for 247 00:07:58,719 --> 00:07:59,231 Experience 248 00:07:59,743 --> 00:08:00,511 A letter 249 00:08:01,023 --> 00:08:02,303 So what you need to know is there 250 00:08:02,815 --> 00:08:04,863 The down direction in the way 251 00:08:05,119 --> 00:08:06,143 Is pasta 252 00:08:06,399 --> 00:08:06,911 So 253 00:08:07,167 --> 00:08:07,935 Thinking about that 254 00:08:08,191 --> 00:08:10,751 What is the proper order that we need to do 255 00:08:11,007 --> 00:08:12,031 To get this to work 256 00:08:12,287 --> 00:08:14,591 When you're subtracting the positive 257 00:08:14,847 --> 00:08:16,127 Always goes first 258 00:08:16,383 --> 00:08:17,151 So mu 259 00:08:17,407 --> 00:08:17,919 Down 260 00:08:18,687 --> 00:08:19,967 Should be our first 261 00:08:20,223 --> 00:08:21,759 Input action here 262 00:08:22,015 --> 00:08:22,783 And then move 263 00:08:23,039 --> 00:08:23,551 Up 264 00:08:23,807 --> 00:08:25,855 And again because down is positive 265 00:08:26,111 --> 00:08:27,391 And up is negative 266 00:08:27,647 --> 00:08:28,159 In the war 267 00:08:28,927 --> 00:08:34,559 Ok so what I'm going to do if I'm just going to instead of returning our movement bacteria let's return vector 2 268 00:08:34,815 --> 00:08:35,839 Use parentheses 269 00:08:36,095 --> 00:08:39,167 And we can just put our x movement and our way 270 00:08:39,679 --> 00:08:40,191 In there 271 00:08:40,447 --> 00:08:43,775 We actually don't need this movement Factor appears I will go ahead and 272 00:08:44,543 --> 00:08:47,103 So there's our method it's going to return to us essential 273 00:08:47,359 --> 00:08:49,151 What the input state is 274 00:08:49,407 --> 00:08:51,455 Sauna process made in let's go ahead and grab 275 00:08:51,711 --> 00:08:53,503 So we're going to save our movement vet 276 00:08:54,783 --> 00:08:55,807 Is he going to get 277 00:08:56,063 --> 00:08:56,831 Movement 278 00:08:57,855 --> 00:09:00,415 Now we need to pull out the direction 279 00:09:00,927 --> 00:09:03,743 Can you maybe saying why can't we just use this as the Direct 280 00:09:03,999 --> 00:09:06,303 Thing is because let's say that you 281 00:09:06,559 --> 00:09:08,607 The writing for press and the up 282 00:09:08,863 --> 00:09:11,167 But you'll get is a vector that is 283 00:09:11,423 --> 00:09:12,447 11 284 00:09:12,959 --> 00:09:14,495 Which technically has a lie 285 00:09:15,007 --> 00:09:16,031 That is greater than 286 00:09:16,543 --> 00:09:17,567 If you take that back 287 00:09:17,823 --> 00:09:20,383 And you X let's say some speed 288 00:09:20,639 --> 00:09:22,175 You actually exceed 289 00:09:22,431 --> 00:09:23,711 The target speed because the 290 00:09:23,967 --> 00:09:24,735 Is greater than 1 291 00:09:25,247 --> 00:09:27,039 So we actually need to normal eyes 292 00:09:27,295 --> 00:09:28,319 This input VAT 293 00:09:28,831 --> 00:09:31,391 So that we get a vector that has a length of 1 294 00:09:31,647 --> 00:09:32,671 So that when we moult 295 00:09:32,927 --> 00:09:34,207 Quiet everything will 296 00:09:34,463 --> 00:09:34,975 As expected 297 00:09:35,487 --> 00:09:37,535 And you can definitely experiment with this with 298 00:09:37,791 --> 00:09:39,839 Normalizing at to see exactly what I'm talking about 299 00:09:40,095 --> 00:09:41,631 But we're just going to go normal 300 00:09:42,143 --> 00:09:43,423 I'm going to save our direct 301 00:09:43,935 --> 00:09:44,703 Is equal to 302 00:09:45,215 --> 00:09:46,239 Movement vector 303 00:09:47,263 --> 00:09:47,775 Norma 304 00:09:48,287 --> 00:09:51,103 So that will return a unit length of Vector 305 00:09:51,359 --> 00:09:52,895 Also known as a vector 306 00:09:53,407 --> 00:09:53,919 Next one 307 00:09:54,175 --> 00:09:54,943 The how are you 308 00:09:55,455 --> 00:09:58,015 Well we should probably define a speed of 4 309 00:09:58,271 --> 00:09:58,783 Character 310 00:09:59,039 --> 00:10:00,063 So what I'm going to do it 311 00:10:00,345 --> 00:10:02,376 Subtitled by online-courses.club We compress knowledge for you! 312 00:10:02,377 --> 00:10:01,087 Underneath 313 00:10:01,343 --> 00:10:02,879 Extend the character body 2D 314 00:10:03,135 --> 00:10:04,671 Going to add a couple of new Lines 315 00:10:04,927 --> 00:10:05,951 And I'm going to say 316 00:10:06,463 --> 00:10:06,975 Can't 317 00:10:07,487 --> 00:10:10,047 And this simply just marks a variable 318 00:10:10,303 --> 00:10:11,071 That cannot be chewed 319 00:10:11,583 --> 00:10:13,119 So I'm going to say 320 00:10:13,631 --> 00:10:15,167 Max underscores 321 00:10:15,935 --> 00:10:18,239 And generally I like to use all car 322 00:10:18,495 --> 00:10:22,335 For constant variables so that I know that they're special and cannot 323 00:10:23,103 --> 00:10:25,407 What's a r max speed do something like to 324 00:10:25,919 --> 00:10:27,711 So we got a max-min here 325 00:10:27,967 --> 00:10:30,527 Now let's go back to our process method 326 00:10:30,783 --> 00:10:31,807 And we're going to say 327 00:10:32,575 --> 00:10:33,343 Velocity 328 00:10:33,599 --> 00:10:35,903 Now where is this velocity coming from 329 00:10:36,159 --> 00:10:39,743 Velocity is actually a property of care to body to die 330 00:10:39,999 --> 00:10:40,767 So let me show 331 00:10:41,279 --> 00:10:42,559 If you press F1 332 00:10:43,071 --> 00:10:46,399 That will open up the documentation within the engine 333 00:10:46,655 --> 00:10:50,239 So go ahead and press F1 and search for character body 2 334 00:10:50,751 --> 00:10:52,031 Guiding light to bring it on 335 00:10:52,287 --> 00:10:55,359 Open up the character body to the document 336 00:10:55,871 --> 00:11:00,735 Now again I'm not going to go over the basics of programming and I'm not going to go over the basics 337 00:11:00,991 --> 00:11:02,271 Reading documentation 338 00:11:02,527 --> 00:11:08,671 Just know the documentation is available in engine so you can see exactly the capabilities of every know that 339 00:11:09,439 --> 00:11:11,743 So have you got a kick about it today you can scroll down 340 00:11:11,999 --> 00:11:14,815 You see all of these properties in all of these 341 00:11:15,327 --> 00:11:19,167 So this is where are velocity is coming from it's a vector to write here 342 00:11:19,423 --> 00:11:20,959 As on the character body 343 00:11:21,215 --> 00:11:24,543 Severus say anything in a script that we haven't previously defined 344 00:11:24,799 --> 00:11:26,335 It's likely that is coming for 345 00:11:26,591 --> 00:11:27,103 EBay 346 00:11:27,615 --> 00:11:32,223 So what do you want to do what we want to set our Velocity right so we say velocity is equal to 347 00:11:32,735 --> 00:11:33,503 Direction 348 00:11:33,759 --> 00:11:34,271 Time 349 00:11:34,527 --> 00:11:35,039 Mark 350 00:11:36,831 --> 00:11:40,159 What that will do is that will send a sad 200 pixels per second 351 00:11:40,415 --> 00:11:41,695 In the direction that we've 352 00:11:41,951 --> 00:11:47,327 Now this is not been waiting we need to do that we need to tell the character body to actually move based on the 353 00:11:47,839 --> 00:11:49,631 So what we're going to do is really call me 354 00:11:50,655 --> 00:11:51,167 Slough 355 00:11:52,959 --> 00:11:57,311 Now if I look at my care about you today what is moving slides say it's all going to go down and click on 356 00:11:57,567 --> 00:12:00,127 Reuben slide says it moves the body based on 357 00:12:00,383 --> 00:12:01,407 Very simple and 358 00:12:01,663 --> 00:12:03,967 What does will do is this will take the velocity 359 00:12:04,223 --> 00:12:06,271 And it will perform any collisions that need 360 00:12:06,527 --> 00:12:08,319 Happened and it will return 361 00:12:08,575 --> 00:12:09,855 Any remaining 362 00:12:10,111 --> 00:12:10,879 From a collision 363 00:12:11,135 --> 00:12:12,159 So you can imagine 364 00:12:12,415 --> 00:12:15,231 If you are going diagonally against a wall 365 00:12:15,487 --> 00:12:17,791 You're going to want to stop the characters from 366 00:12:18,047 --> 00:12:18,815 Me in the wild 367 00:12:19,071 --> 00:12:20,607 Directions of your going up against the 368 00:12:21,119 --> 00:12:22,143 What does stone 369 00:12:22,399 --> 00:12:24,447 Text component to the movement because he's going down 370 00:12:24,959 --> 00:12:26,495 So moving slide 371 00:12:26,751 --> 00:12:29,311 Will the zero out the Y component of the blood 372 00:12:29,567 --> 00:12:32,895 But use the remaining excellence you to continue move 373 00:12:33,407 --> 00:12:34,175 The character body 374 00:12:34,687 --> 00:12:36,991 And so this is really nice for creating smooth 375 00:12:37,503 --> 00:12:39,551 Collisions where the player still has 376 00:12:40,063 --> 00:12:42,623 And this will modify velocity under the hood 377 00:12:42,879 --> 00:12:44,415 Which is useful when you're doing 378 00:12:44,671 --> 00:12:45,695 Things like accelerate 379 00:12:45,951 --> 00:12:47,487 Which will get into in 380 00:12:47,743 --> 00:12:48,255 Future let's 381 00:12:48,767 --> 00:12:51,327 So everything is correct we should be able to me 382 00:12:51,583 --> 00:12:52,351 But 383 00:12:52,607 --> 00:12:53,375 We don't 384 00:12:53,631 --> 00:12:55,679 Have a scene for the player to move around 385 00:12:56,191 --> 00:12:57,215 So let's go out and do that 386 00:12:57,471 --> 00:13:01,055 So let's go back to our 2D mode up here by clicking the 2D button 387 00:13:01,311 --> 00:13:04,383 Let's go to scene at the top news 388 00:13:04,895 --> 00:13:06,943 And the new scene window here 389 00:13:07,199 --> 00:13:08,479 What's quick other now 390 00:13:08,991 --> 00:13:10,783 And use a node based 391 00:13:11,807 --> 00:13:14,111 I'm going to rename this to main 392 00:13:14,367 --> 00:13:15,391 And I'm going to see it 393 00:13:15,647 --> 00:13:17,695 I'm going to go into my Simms directory 394 00:13:17,951 --> 00:13:19,999 I'm going to right click into here click a new phone 395 00:13:20,767 --> 00:13:21,535 And bright 396 00:13:21,791 --> 00:13:22,303 Main 397 00:13:22,815 --> 00:13:23,583 And then I'll say 398 00:13:24,095 --> 00:13:28,191 So we should have a main scene under the rest seems me 399 00:13:28,447 --> 00:13:28,959 Main 400 00:13:29,215 --> 00:13:29,727 80s 401 00:13:30,239 --> 00:13:31,263 Why we need to do this 402 00:13:31,775 --> 00:13:32,799 This is going to be 403 00:13:33,055 --> 00:13:35,615 Our amazing this is going to be where the game 404 00:13:36,127 --> 00:13:36,639 Takes place 405 00:13:36,895 --> 00:13:38,431 This is where we can add h 406 00:13:38,687 --> 00:13:39,199 Player 407 00:13:39,455 --> 00:13:40,735 So what's right click on mean 408 00:13:40,991 --> 00:13:43,551 What's quick instantiated child scene 409 00:13:43,807 --> 00:13:45,343 What this does is this 410 00:13:45,599 --> 00:13:48,927 Allows us to take a pre-built scene and put it into 411 00:13:49,439 --> 00:13:50,463 The sea network currently 412 00:13:51,231 --> 00:13:53,535 I'm going to go ahead and click that and then click on player 413 00:13:54,303 --> 00:14:00,447 And now you can see that our player and all of its configured nodes are represented here as a single now 414 00:14:00,959 --> 00:14:06,079 And I've got a couple of nice buttons your friends and they want to edit the players in I can collect this awesome button here 415 00:14:06,335 --> 00:14:08,383 And I'm back to the place now watch this 416 00:14:08,895 --> 00:14:11,711 I'm just going to do this for demonstration purposes you don't have to do that 417 00:14:11,967 --> 00:14:14,015 If I add a colour rectangle here 418 00:14:14,271 --> 00:14:15,807 Which is basically a big white square 419 00:14:16,063 --> 00:14:17,343 Can I go back to my main 420 00:14:17,599 --> 00:14:18,111 Wicked 421 00:14:18,367 --> 00:14:20,927 So any changes are made to the player is reflected 422 00:14:21,183 --> 00:14:22,463 In this play scene 423 00:14:22,719 --> 00:14:23,743 And in the main 424 00:14:24,255 --> 00:14:27,327 So you can probably already see how we're going to be using 425 00:14:27,583 --> 00:14:28,095 These 426 00:14:28,351 --> 00:14:30,399 Various different seems to build out 427 00:14:30,655 --> 00:14:31,679 Largest 428 00:14:31,935 --> 00:14:33,215 And a nice thing is that 429 00:14:33,471 --> 00:14:35,007 The pleasure is all nice and so 430 00:14:35,263 --> 00:14:35,775 Contained 431 00:14:36,031 --> 00:14:39,103 So that way any changes I make here will be reflected at 432 00:14:39,359 --> 00:14:40,383 That's all instances 433 00:14:40,639 --> 00:14:41,407 The player across 434 00:14:41,663 --> 00:14:42,175 The game 435 00:14:42,431 --> 00:14:47,295 Which will only have one player in the game but it'll be really useful when we start making a 436 00:14:48,063 --> 00:14:48,575 Ok 437 00:14:48,831 --> 00:14:50,879 So let's go ahead and take the player and move 438 00:14:51,135 --> 00:14:51,647 Movie 439 00:14:51,903 --> 00:14:55,999 The origin of little bit so just drag him down to the right 440 00:14:56,255 --> 00:14:58,303 And then go ahead and click the play button 441 00:14:58,559 --> 00:15:02,399 Add the top of the window and you can also press F5 if you 442 00:15:02,911 --> 00:15:05,727 Now I will get a warning that says we don't have a main c 443 00:15:05,983 --> 00:15:08,799 Godot needs to have a scene to find which 444 00:15:09,055 --> 00:15:10,335 The first seen it loads 445 00:15:10,591 --> 00:15:11,871 When your game store 446 00:15:12,639 --> 00:15:14,175 And so we're just gonna go ahead 447 00:15:14,431 --> 00:15:16,735 Current if you've ran the game from the main c 448 00:15:17,247 --> 00:15:19,807 Be careful not to Run the game from the pliocene because 449 00:15:20,063 --> 00:15:21,087 Select 450 00:15:21,343 --> 00:15:22,623 You'll be running around 451 00:15:23,135 --> 00:15:24,927 So make sure that mean is selected 452 00:15:25,183 --> 00:15:26,975 Go ahead and click play and then select 453 00:15:27,743 --> 00:15:28,767 So the game is start 454 00:15:29,023 --> 00:15:29,535 And 455 00:15:29,791 --> 00:15:31,583 If you got a configure the same as me 456 00:15:31,839 --> 00:15:33,119 You'll see what the player is 457 00:15:33,375 --> 00:15:34,911 Very very tiny 458 00:15:35,423 --> 00:15:40,031 If you use the wasd and arrow keys you can see that our player is moving 459 00:15:40,543 --> 00:15:41,311 Quite well 460 00:15:41,567 --> 00:15:44,639 Now obviously we still have a lot of work to do with the plane 461 00:15:44,895 --> 00:15:46,943 But that is basically remove 462 00:15:47,455 --> 00:15:48,223 In the next life 463 00:15:48,479 --> 00:15:50,527 Will setup a proper window scales 464 00:15:50,783 --> 00:15:51,295 Turn the players 465 00:15:51,551 --> 00:15:52,063 So tiny 466 00:15:52,319 --> 00:15:56,927 And then will also start work on creating an environment for the player to walk around 29697

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