All language subtitles for 2. Addition & Subtraction--- [ FreeCourseWeb.com ] ---

af Afrikaans
ak Akan
sq Albanian
am Amharic
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
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

Original subtitles

So it always surprises me how successful some really simple games like this can be my son absolutely

loves playing this sort of game on his iPod.

And this is entirely based at this stage on addition and subtraction.

So even with these simple mechanics we can have a lot of fun.

So let's dive in and start with the very basics of mathematics addition and subtraction so you in the

Okay guys let's get moving let's get on with addition and subtraction the very starting point now look

I'm not going to keep you too long with this because it's simple stuff but there are a few gotchas with

regards to game development that I want to show you about.

So throughout this course we're going to be using something that I'm going to call the number line as

a starting point.

So that's just a line in space I'm drawing here.

All right.

And then we're going to imagine to start with that we have a zero point maybe on the left hand side

here.

So this is just a line that represents numbers and this guy here is zero.

So as our numbers progressed we've got one and then maybe two and then maybe three and then maybe four.

OK.

Now addition is simply moving to the right on this number line like so each time we add one we're doing

this.

If we were to add four we would be doing this nice and simple.

So that's addition what is subtraction.

Well subtraction is moving left.

So maybe I use a different color for subtraction perhaps a gain a green if we were to take four and

subtract two we get down to two.

OK.

And if we were to subtract take one and subtract one we get down to zero.

Very simple.

So the other option that we have here is to have a negative values on the number of lines.

Let's take a little look at how that would work.

So we can have a very similar number line.

But this time let's imagine that this number line the zero is shifted across and that we have zero here.

All right.

Right in the middle there.

Let's say now we can play with things called negative numbers.

So if I have maybe 0 1 sheep or two sheep or three sheep and I want to take away a certain number of

sheep then if you said hey you've got two sheep give me three.

We would end up back here at a number that we're going to call minus one.

So negative numbers.

All right super simple.

That's all I'm going to say about the number line for the moment for you.

So what we need to think about when we're using a game engine with numbers is a few things.

Firstly we want to look at overflow limit.

So if I pop here this is an older version of Unity game engine and it doesn't matter it's the same in

a lot of languages and I start with a big number.

Now I've chosen this number for a reason.

This is we'll find out later.

A 32 bit integer.

So this means the total size that this can be is just over 2 billion.

So I've set them under just under its limits and then I've just got a thing that's going to print out

the number and then keep updating it.

So let's just look at that happening.

So I come along I hit play.

We go to the console and look what happens if we scroll back in the console the number goes up and up

and up and up and then eventually hook ups suddenly goes negative.

Mm hmm.

So we'll find out what's going on there.

At another stage in the course when we look at the floating point representation.

But what you need to understand is that one of the gotchas on a computer is the idea that you have limits

of a number.

And it may not fail nicely you may end up with it going from 2 billion to minus 2 billion when your

code said to do is to add what's so big got you.

There are other things we need to look at is the idea that when we're placing things together on a computer

we're not necessarily dealing with the same time.

We may have on one side of this we may have a hole number somewhere else we may have a decimal number

so we need to be a little bit careful of that plus operators on computers tend to do lots of different

things and you sometimes need to hover over them or look in your documentation to find out exactly what

your your thing is doing on machines day.

And the other thing to say about addition and subtraction is it can be done in any order so addition

can be done in any order one plus two equals two plus one.

The same thing they both equal three when it comes to subtraction.

They can't be done in any order one minus two does not equal and I'm going to use that symbol there

which is an equals with a cross rate does not equal to minus one because one minus two is minus one

as we saw before and that does not equal to two minus one which is one.

All right.

So be careful of the order of subtraction.

Understand that you could blow your limits on a computer of what is possible in terms of the range of

the numbers you're dealing with and be a little bit careful those plus operators because I can catch

you out they might do things you're not expecting that's enough on addition of subtraction for now let's

dive into the next lecture.

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