Enemies Movement... How ? #TerrariaExample

I was playing terraria and i kept thinking… how some monsters behave!
For instance, the boss “Eye of cthulhu” and the small eyes which keep trying to follow you but are so DUMB* that they keep smashing into walls and bouncing.

Question : How did they code it? Its hard to imagine how they coded a “dumb” eye and that Chtulu movement.

Anyone have a light on this? Its just me or everyone have some difficulty on it

Starts at 8:00
PS : ITS NOT MY VIDEO

He’s not dumb, he just has a difficulty reversing the velocity so when he starts charging towards you it takes some time for him to come to a halt if he misses. :slight_smile:

Mike

But what about when the eyeballs bounces into a wall…
Like you are in one side of a wall, and its is in the other side and it keeps trying to pass through

Same thing but with collision detection.

That would be really easy in a way,

Just have no path finding for the mob. check for collision and it will bump out, and just set a negative velocity.

so it will never know if a wall is in front of it, but if it hits it, it will bounce back.

EDIT: fixed it up, wrote character instead of mob

So it just uses Euclidean Distance? Also it sometimes just stand still and shoot… but it doesnt seem to have a fixed Timer…