Topdown 2D RPG In Unity - 12 Enemy AI

Check out my latest video! : "Topdown 2D RPG In Unity - 22 Player Stats"
• Topdown 2D RPG In Unit... -~-
In this video, we will be giving our enemy some movement using basic AI.

Пікірлер: 33

  • @LordZandaurgh
    @LordZandaurgh4 жыл бұрын

    Cool beans man! Really professional intro for such a small channel! Keep up the good work!

  • @kwinoo2814
    @kwinoo28144 жыл бұрын

    When you said: First up, he's moon walking. I laught so hard, Ty for the series even tho you abandon it cuz of the lost :(

  • @netroalex5209
    @netroalex52093 жыл бұрын

    You're like the only guy who wants to see error messages to remove them at the end And also thanks for the tutorial

  • @AndyBandi2000
    @AndyBandi20003 жыл бұрын

    Just a tip: you can also make that HomePosition a child to the Enemy (Skeleton), and in the Start just add homePos.parent = null; It will make HomePosition a seperate object (object without a parent as it is in the video) which will not follow the Enemy. this way you can have a complete prefab, and it will not confuse you with the coordinates in case you add multiple Enemy prefabs.

  • @johnathanherbert3204

    @johnathanherbert3204

    3 жыл бұрын

    Thanks!!!!!!!!!!!!!!!!!!!!!!

  • @bradhudson9544
    @bradhudson95445 жыл бұрын

    Great material my man.

  • @okay1296
    @okay12962 жыл бұрын

    Thank you for this video. This is my first time im working with unity and generally making a game. You are explaining everything really good! Thank you for awesome videos. Subscribed and liked you xD

  • @anthonydultra7528
    @anthonydultra75284 жыл бұрын

    it helps me a lot thanks for sharing

  • @eniocc
    @eniocc3 жыл бұрын

    Good Conten. Thanks for the Channel. Happy New year.

  • @jood7449
    @jood74493 жыл бұрын

    thank you man you helped me a lot i appreciate it

  • @david_chan_95
    @david_chan_953 жыл бұрын

    Thank you so much! Very helpful, like!

  • @ololololololoj5634
    @ololololololoj56342 жыл бұрын

    Great video!

  • @antoniosilva1393
    @antoniosilva13932 жыл бұрын

    Huge ty :)

  • @connorwellercheese
    @connorwellercheese3 жыл бұрын

    And you can outsmart him by walking around an obsticle.

  • @romansoucek7041
    @romansoucek70414 жыл бұрын

    Hi man, great work, but is there any way, how make moving around other objects( wall etc...). Thanks :)

  • @JMacify
    @JMacify3 жыл бұрын

    Why did you use a Vector3 instead of a Vector2?

  • @jtubef8620
    @jtubef86202 жыл бұрын

    What if I just want it to stop and idle in whatever direction it was facing, instead of going back to the home point?

  • @gxplay2270
    @gxplay22703 ай бұрын

    It helped!

  • @iop313

    @iop313

    Ай бұрын

    How do u maked ur enemy follow the player? my script don't show any errors but nothing happend

  • @gxplay2270

    @gxplay2270

    28 күн бұрын

    @@iop313 difference between points. If you still haven't done i can write how i did it

  • @iop313

    @iop313

    28 күн бұрын

    @@gxplay2270 It Ok man The day afther it work

  • @SSMLivingPictures
    @SSMLivingPictures3 жыл бұрын

    @HundredFireGames Wondering if youd be able to help out. Im trying to do something very similar with my game with the enemies, except that I want them to move randomly. My script already works, and thet move like I want them, but as far as applying the proper animations to their movements, Im struggling with the "anim.SetFloat("MoveX", (sticking point here). In your video you subtracted the enemies position by the target position, but with random movement, Id subtract the enemies position by?...or a diff equation all together. Any suggestions by anyone would be greatly appreciated.

  • @medmax6955
    @medmax69554 жыл бұрын

    Thanks for sharing it. I had the same. But there is a big problem. When the enemy try to follow you if there is an obstruct between your player and the enemy. The enemy can't move because of the obstruct. Will you add more property for it?

  • @thecanaeggplant2937

    @thecanaeggplant2937

    3 жыл бұрын

    Yea aggred

  • @faiz7180
    @faiz71804 жыл бұрын

    I uses the maxRange and minRange but the enemy still managed to push my character. How do i fix this?

  • @alexanderst.7993

    @alexanderst.7993

    4 жыл бұрын

    Play around with the values maybe ur x and y are different in ur game mine minRange was at 8 Only problem im having is my dude wont go back to his og position lol

  • @antreasstylianou6492
    @antreasstylianou64922 жыл бұрын

    how do i make my enemy go back to home position without stacking at walls or objects?

  • @nyooman5552

    @nyooman5552

    2 жыл бұрын

    If you mean go back home without being jittery then move the enemy to where you actually want him to be, then copy and paste the XY coordinates from his location to the XY coordinates of the home location. That fixed his home jittery issue for me.

  • @antreasstylianou6492

    @antreasstylianou6492

    2 жыл бұрын

    @@nyooman5552 thanks a lot

  • @LordZandaurgh
    @LordZandaurgh4 жыл бұрын

    You were talking kinda slow, so I brought the playback speed to 1.5x and it sounds like someone talking at a normal speed. XD

  • @Ytomany

    @Ytomany

    4 жыл бұрын

    Omg lol your actually right

  • @PopLucian90
    @PopLucian904 жыл бұрын

    How could I do the movement using Velocity rather than transform.position, for the enemy? I used this, but it's not a good solution - the enemy never actually gets to the player, nor to home position, therefore the difference between the vectors is never 0. Also, the greater the distance, the greater the speed - even if multiplied by moveSpeed, the same issue occurs. goblinRigidbody.velocity = new Vector3((target.transform.position.x - transform.position.x), (target.transform.position.y - transform.position.y)); //goblinRigidbody is the Rigidbody2D component on the enemy I think it's a very easy solution which just escapes me, does anyone have any suggestions?

  • @jacobbotello6369

    @jacobbotello6369

    4 жыл бұрын

    I'm new to this, so if my comment sounds like utter nonsense, feel free to disregard it! =) (Also, I see that your comment is three months old, so hopefully you've figured it out, and maybe this'll help someone reading.) I think there are a couple things that might help: 1) You're just setting the velocity rather than using "MoveTowards()". The reason this method might help you (if it can be applied to velocity on a rigidbody) is because it takes a speed parameter (i.e. "MoveTowards(object 1, object 2, speed"). This might help you travel more evenly. 2) I have a rigidbody on my enemy, but MoveTowards() works fine just managing "transform". Is there a reason that you have to use velocity? I believe velocity considers things like mass, friction, etc, and those may be getting in your way. I'm sure you can set all of these settings to "0", but that sounds like a lot of hassle (compared to just managing "transform.position"). 3) You don't need the difference between the two objects to be zero. The enemy should move when his distance from the character is greater than the minimum distance. If you set the minimum distance (the tutorial has it as "minRange") to, say, 0.5, your enemy will stop ~when he makes contact with the player. Try setting "minRange()": to something other than "0".