Search Unity

2d game enemy navigation

Discussion in 'Navigation' started by DarkerWarrior, Feb 10, 2022.

  1. DarkerWarrior

    DarkerWarrior

    Joined:
    Jan 2, 2020
    Posts:
    5
    Hi!
    I am making a 2d game and it is going really well, but I'm really struggling with enemy AI. The cube is the main character in my game and the saw is the alien that must chase him to kill him, but the saw begins to chase the cube when the saw touches cube's collider. I have tried to find tutorials on Youtube, but there is nothing that is similar to my problem. I am not some master coder and I am 12 years old so I couldn't come up with a code that would solve my problem, although I tried really hard. I would really appreciate your help because I've been working on this game for a long time and I don't want to quit. Any solution would bee good. If you don't want to write code you can give me link to videos if you know any good videos. Thank you in advance and have a nice day. :);)
     

    Attached Files:

  2. Inxentas

    Inxentas

    Joined:
    Jan 15, 2020
    Posts:
    278
    I'm on mobile so I have to keep this brief, but google around for a Brackeys tutorial on the subject. For 2D games you might want to use an A* algorithm for this task.

    Those are a bit of a pain to code yourself but there used to be a package for that, as per that tutorial. Not sure if its up to dat though.