MELEE COMBAT in Unity

MELEE COMBAT in Unity

Brackeys

4 года назад

1,615,735 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

𝓕r𝓸s𝓽v𝓻
𝓕r𝓸s𝓽v𝓻 - 05.11.2023 18:01

Can somebody help me it says The type or name space enemy could not be found😅

Ответить
Marzieh
Marzieh - 03.11.2023 21:34

Who's watching Brackeys' tutorials from 2023?👀

Ответить
alif official
alif official - 29.10.2023 21:39

thank you soo much this help me a lot, this is super easy

Ответить
Parmesan Zero
Parmesan Zero - 18.10.2023 20:51

This was a better tutorial and gave me a better understanding than much longer and more involved ones in how to use unity.

Ответить
Marvin Barboza
Marvin Barboza - 03.10.2023 11:05

For those people who want to delay the hurt animation, you can use this code:

public Animator animator;
public int maxHealth = 100;
private int currentHealth;

// Add a delay before the Hurt animation (in seconds)
public float hurtDelay = 1.0f;

private void Start()
{
currentHealth = maxHealth;
}

public void TakeDamage(int damage)
{
currentHealth -= damage;

// Use a Coroutine to introduce a delay before playing the "Hurt" animation
StartCoroutine(DelayedHurtAnimation());

if (currentHealth <= 0)
{
Die();
}
}

private IEnumerator DelayedHurtAnimation()
{
// Wait for the specified delay before playing the "Hurt" animation
yield return new WaitForSeconds(hurtDelay);

// Play Hurt Animation
animator.SetTrigger("Hurt");
}

private void Die()
{
Debug.Log("Enemy Died");
animator.SetBool("IsDead", true);

GetComponent<Collider>().enabled = false;
this.enabled = false;
}
}

Ответить
Viktorius Nasmus
Viktorius Nasmus - 15.09.2023 13:21

This veri helpfyl
🤑🤠😎

Ответить
Zene TV
Zene TV - 13.09.2023 17:27

Pretty good video!!

Ответить
Zoro FF 🇪🇬
Zoro FF 🇪🇬 - 05.09.2023 13:11

I Write with you But not working please someone Write it for me please 😭😭😭😭😭😭

Ответить
桂仕啸
桂仕啸 - 02.09.2023 16:03

Very good video, love from China!

Ответить
kekex
kekex - 30.08.2023 19:48

Bro my enemy when die he's falling I cant fixed it

Ответить
KennyFromHeaven
KennyFromHeaven - 09.08.2023 23:10

since i wanted to do a longer attack dilated in time, i just put a 2d collider (trigger) on the empty object; i set it to enabled = false inside the start() method , and when the attack button is pressed, i enable the collider and then i disable it with invoke() after tot seconds so it ends at the same time the animation does.
Then, i use OnTrigger2DEnter to get the collision with the enemy. it seems to work just fine. any opinions?

EDIT: i forgot to say i wrote a function that makes the collider follow the player, similar to a camera controller. this way, you can attack both ways and the collider will follow if you turn around suddenly while attacking.

Ответить
Somethings are bound to change.
Somethings are bound to change. - 09.08.2023 17:33

Isn't there a problem for someone who wants to attack both ways so left and right? because the sword is part of the character sprite but if you make the sword seperate somehow you could make the attackpoint part of the sword and therefore if the sword can flip then the attack point can flip

Ответить
Gabi Paun
Gabi Paun - 27.07.2023 18:16

I keep getting in Unity the red message "Top level statemants must precede namespace and type declarations". How do I fix this?

Ответить
Gabi
Gabi - 14.07.2023 12:44

I have a problem that when i hit the enemy, it takes more damage than it should, and with one hit the health goes down to -1000 or lower

Ответить
yahyabzl
yahyabzl - 14.07.2023 07:24

you can do destroy object instead of doing dying animation when the enmy is dead

Ответить
Max Chacon
Max Chacon - 14.07.2023 03:48

but like what if we have different enemy scripts though

Ответить
MalaKurwaNechapu
MalaKurwaNechapu - 24.06.2023 19:33

jachyme budnaaa

Ответить
Chiara B
Chiara B - 23.06.2023 22:33

this is the best tutorial ive seen out there

Ответить
Phước Nguyễn
Phước Nguyễn - 23.06.2023 18:44

I've just started to learn Unity and luckily seen these your videos, it's truly practical

Ответить