Комментарии:
I love you
Ответитьhello again my friend,
The enemy character is following, but while falling vertically, it goes down slowly while on top of the player.
I want it to fall on me, what are we going to do?
thank you.
***If I couldn't explain it fully, I can send the screenshot as an e-mail.
thanks bro !
ОтветитьGreat video and teacher I'm having this issue the enemy's follow me but when I jump on them they just fall through the floor , and when i jump off a platform they just keep following me floating. Just starting to get back into game dev. :)
ОтветитьJohn, please do a full fledged enemy controller, with melee, ranged, flying options.... including the animations. You must have done it for your game.
You're so easy to follow, I want to learn from you.
Thanks.
Thanks for this video. How can I make it so that the enemy stops when in attacking range as well as when it is not in aggro range. Because right now he is still running towards the player and when I leave the aggro range it will then do the animation for attacking
ОтветитьGreat video, Do you have a video making a basic finite state machine for enemy AI. Thank you.
ОтветитьIn the immortal words of Mr. Burns... "....Excellent."
ОтветитьThanks, nice tutorial.
ОтветитьThanks
ОтветитьI'd really like a version of this for 3d rigidbodies. Great video though!
ОтветитьFor issues with enemy vibrating back and forth, while player is above, I added this to ChasePlayer:
if (transform.position.x - player.position.x <= 0.5f && transform.position.x - player.position.x >= 0f)
{
StopChasingPlayer();
}
Damn Son Where'd ya find this
ОтветитьGreat tutorial
Ответитьgood man cool video thank you
Ответитьthis is best tutorial i have ever seen, thanks a lot. 👌
ОтветитьTURNNNN ON DARK MODE PLEASEE
ОтветитьGreat tutorial! So my plan was to set my enemy active when its in the distance and disable it when its not. I did the if statments and inside I put gameObject.SetActive(true); if disttoplayer<aggrorange and in the else I put gameObject.SetActive(false); When I go out of the range it turns off but never back on (I'm guessing its becuase it is turned off so the script isnt running) , any idea on how to fix that?
ОтветитьThis tutorial worked flawlessly for me. i have 3 different enemy AI types now
ОтветитьMost underrated unity tutorial channel. Its more simple than triggerenter,stay and exit.
Ответитьidk why but it just didnt work
ОтветитьGreat video! But whenever I get directly above or below the enemy, it starts flipping back and forth really fast because it can’t decide which direction to go. Any ideas?
Ответитьhello anyone have some problem like mine did? my enemy keep spinning like crazy when i jump over it to the left but it's normal when i jump over it to the right. i've followed the tutorial precisely thou. really strange
ОтветитьThanks!
ОтветитьHemos this doesnt seem to work on prefabs
Ответитьyou remind me of john wick
ОтветитьTnx so mush good video
ОтветитьI have a problem, when I entered "transform.localScale = new Vector2 (-1, 1);" when the enemy rotates his scale becomes huge
ОтветитьGood Tips
ОтветитьThank you so much for this awesome tutorial! This helps immensely!
Ответитьthe code works perfect, but the enemy falls so slow any hint?
Ответитьhere is a script for up-down games you might have t change it a little for you're game Mabey using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Enemy : MonoBehaviour
{
[SerializeField]
public Transform player;
private Rigidbody2D rb;
private Vector2 movement;
[SerializeField]
public float moveSpeed = 5f;
[SerializeField]
float agroRange;
void Start()
{
rb = this.GetComponent<Rigidbody2D>();
}
void Update()
{
float distToPlayer = Vector2.Distance(transform.position, player.position);
Vector3 direction = player.position - transform.position;
direction.Normalize();
movement = direction;
if(distToPlayer < agroRange)
{
moveCharacter(movement);
}
else
{
StopChasingPlayer();
}
}
private void StopChasingPlayer()
{
rb.velocity = new Vector2(0, 0);
}
void moveCharacter(Vector2 direction)
{
rb.MovePosition((Vector2)transform.position + (direction * moveSpeed * Time.deltaTime));
}
}
how would you do this with the y axis
ОтветитьINSANE thks you !!
Ответитьhow can i make it go on the y axis as well
ОтветитьThat's awesome!
Ответитьthanks!
ОтветитьI love You, you are amazing
Ответитьwhen i do prefab the enemy forget about player (None Transform)
ОтветитьThanks keanu love your tutorials
Ответитьthis is the third video I watch to code a damn aggro, nothing worked, the enemy is standing still doing nothing. What can it be?
Ответитьfor a cleaner script. "don't" serialize the variables, and instead start each with "public" (including the rigidbody2d) and instead of the GetComponent with the rigidbody2d (in the start function), just add the same way you did with the player transform. hope this helps.
ОтветитьBest tutorial please make more I love it<3
ОтветитьIf you have your scale higher than 1 on your enemy, and then it calls the transform.localScale = new Vector2(1, 1); my enemy just turns small. I think that's the problem but I dont know how to fix it. Could I change the size of my enemy without doing it in the transform? Also it looks the opposite way of where the player is once it finds it. (still chases it though, just backwards and small).
ОтветитьI know this comment is a bit late but if anyone can help plz do it..so the problem is my enemy squeezes when the player enters the range.other than tht everything works fine
ОтветитьThank you man
Ответить