Комментарии:
Can somebody help me it says The type or name space enemy could not be found😅
ОтветитьWho's watching Brackeys' tutorials from 2023?👀
Ответитьthank you soo much this help me a lot, this is super easy
ОтветитьThis was a better tutorial and gave me a better understanding than much longer and more involved ones in how to use unity.
Ответить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;
}
}
This veri helpfyl
🤑🤠😎
Pretty good video!!
ОтветитьI Write with you But not working please someone Write it for me please 😭😭😭😭😭😭
ОтветитьVery good video, love from China!
ОтветитьBro my enemy when die he's falling I cant fixed it
Ответить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.
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
ОтветитьI keep getting in Unity the red message "Top level statemants must precede namespace and type declarations". How do I fix this?
Ответить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
Ответитьyou can do destroy object instead of doing dying animation when the enmy is dead
Ответитьbut like what if we have different enemy scripts though
Ответитьjachyme budnaaa
Ответитьthis is the best tutorial ive seen out there
ОтветитьI've just started to learn Unity and luckily seen these your videos, it's truly practical
Ответить