Topdown 2D RPG In Unity - 12 Enemy AI

Поділитися
Вставка
  • Опубліковано 25 лис 2024

КОМЕНТАРІ • 33

  • @AndyBandi2000
    @AndyBandi2000 4 роки тому +13

    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.

  • @gxplay2270
    @gxplay2270 7 місяців тому +1

    It helped!

    • @iop313
      @iop313 5 місяців тому +1

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

    • @gxplay2270
      @gxplay2270 4 місяці тому +1

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

    • @iop313
      @iop313 4 місяці тому

      @@gxplay2270 It Ok man The day afther it work

  • @netroalex5209
    @netroalex5209 3 роки тому +4

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

  • @kwinoo2814
    @kwinoo2814 4 роки тому +11

    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 :(

  • @okay1296
    @okay1296 2 роки тому

    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
    @anthonydultra7528 5 років тому +4

    it helps me a lot thanks for sharing

  • @LordZandaurgh
    @LordZandaurgh 5 років тому +1

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

  • @bradhudson9544
    @bradhudson9544 5 років тому +1

    Great material my man.

  • @eniocc
    @eniocc 3 роки тому

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

  • @ololololololoj5634
    @ololololololoj5634 3 роки тому

    Great video!

  • @jood7449
    @jood7449 3 роки тому

    thank you man you helped me a lot i appreciate it

  • @connorwellercheese
    @connorwellercheese 4 роки тому +1

    And you can outsmart him by walking around an obsticle.

  • @JMacify
    @JMacify 4 роки тому +1

    Why did you use a Vector3 instead of a Vector2?

  • @antoniosilva1393
    @antoniosilva1393 3 роки тому

    Huge ty :)

  • @windy-autumn
    @windy-autumn 4 роки тому

    Thank you so much! Very helpful, like!

  • @romansoucek7041
    @romansoucek7041 4 роки тому +2

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

  • @jtubef8620
    @jtubef8620 2 роки тому

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

  • @medmax6955
    @medmax6955 5 років тому +3

    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?

  • @SSMLivingPictures
    @SSMLivingPictures 4 роки тому

    @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.

  • @faiz7180
    @faiz7180 4 роки тому

    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
    @antreasstylianou6492 2 роки тому

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

    • @nyooman5552
      @nyooman5552 2 роки тому +1

      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 роки тому +1

      @@nyooman5552 thanks a lot

  • @LordZandaurgh
    @LordZandaurgh 5 років тому

    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
    @PopLucian90 4 роки тому +1

    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".