All language subtitles for 4. HP System

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
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
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

0 Let's now look at the HP system. 1

You'll find this system in the demo folder. 2

prefabs/systems/HPSystem 3

The HP system is a critical part of the project. 4

It allows objects to have life and get destroyed if they take enough damage. 5

Most of the code here is actually to update the health bar (UI) associated with it. 6

And all of the children objects here handle the health bar and the health healing effect. 7

The lasted time, which when it'll get triggered, it'll regenerate health and the health regeneration 8

animation. 9

So, functionality wise HP system has two important features the maximum HP and the current HP. When take 10

damage is called. 11

This is the most important function because when things damage is called, then we need to subtract 12

the amount from the current HP and if it reaches zero. 13

If the current HP reaches zero for the first time, we can check if it reaches zero, but we don't 14

know if it's the first time. 15

This is what is_alive is for. Because if is the first time, then is_alive is true and then 16

it gets false and then it won't be true for the next time the current HP gets below zero. And the HP 17

system actually has two signals on_damage_taken and on_destroyed. 18

When it gets hit on damage taken happens. 19

And this is important for the enemies when they get hit by the player to actually acquire the target 20

and when on_destroyed happens. 21

This is important because we need to actually destroy the object, but you don't want it to be destroyed 22

here in HP system because there are some other steps that need to be taken to destroy other objects (referenced by this one). 23

It's important to get the signal and then use it for later purposes. 24

The other main functionality of the HP system is regenerating health. 25

As you can see here, if the HP system receives damage, the last hit timer gets reset. 26

Once the lasthit_timer 27

is 0 28

Then the should_heal variable is set to true. 29

And this means that from this moment on, the HP will heal itself. 30

How is this happening? 31

At every frame, if should heal is true, then the current HP gets added. 32

The healing factor * delta, and if the current HP is equal or more than maximum HP then we set 33

it to be maximum HP. And then the animation player stops the animation. 34

This is just an animation that sets everything to zero and of course it updates the UI. 35

The UI is basically this bar, which is actually a gradient that has two values. 36

I'll quickly show you what it does. 37

First, we get the gradient from this one and we set the offsets of this one. 38

But when update HP ui happens, it sets the two colors. 39

The first one with index zero is red and then the green one because first we have everything green. 40

The red will start from the left, but it will start from nothing. 41

And then we set the offsets of these. 42

If the player or the enemy gets more and more damage, these will change. 43

I'll quickly show you. 44

This is the red it has like nothing happening, but once it starts taking damage, the offsets move. 45

The red is more than green 46

now. If I go far away, then at some point my healing will kick in. 47

This is the healing animation. It's just basically fade in / fade out for that background, but it will 48

actually slowly heal me. 49

And this can be tweaked here at the Heal Factor, so you can adjust it as much as you want. 50

Lastly, what I want to mention is that the system is meant to be integrated below the kinematic body 51

of either the player or the enemy. 52

And this is needed because once this object gets detected from the projectile collision, they will 53

ask for the HP system directly. 54

It's important for the HP system to be here. 55

Otherwise, if the hierarchy were different for the player and the enemy, then it would have been a 56

mess of a code to make everything work. 57

This is why it's important that the HP system is a child of the object that takes the collision directly. 58

Basically, this is the HP system. 59

I hope you like it and leave me a comment if you did.

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