I need help with making enemies avoiding collisions/objects without the A* algorithm

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Name277

Hello, I’ve been following an action RPG series by HeartBeast and I went up to making the enemies but I want them to go around collisions and still be able to follow the player. The best and simplest solution so far that I could find was this article from abitawake:

I went through this and I was really confused, I skipped the getting started step since I got no idea about where the enemy variable came from so instead of this:

I’m using this:

So I went to the next step, I got this error here:

I also created the Scent.tscn which has a Node2D named Scent and a Timer, the Node2D has a script attached with the same code as in the article:

This is where I am currently stuck at, I would really appreciate some help, thanks.

:bust_in_silhouette: Reply From: Ngong8

Have a look a bit with the link you posted here, seems like that tutorial uploader doesn’t include the declaration of the “player” variable in the Player.gd.
Here, try this:

func add_scent():
  var scent      = scent_scene.instance()
  scent.player   = self # Change to this
  scent.position = position # Also this