[SOLVED] How do I make the entity move around and chase you if it sees you?

Hello everyone I am making a game where you are in a forest and you have to get some parts to fix your car but a scp is loose, I am writing this in order to get some help on how I can make the scp chase you and if it catches you you die but if not, go another way, any ideas would help me a lot :slight_smile:
this is the link to my project PlayCanvas | HTML5 Game Engine
I tried to make the scp move with a simple animation but it stops, I don’t know what to do

Hi @Ricardo_Reyes!

I have created a Basic Enemy AI example project. Maybe something like that is what you are looking for?


thanks but how do i stop shooting and I have two errors called
this.enemyHud.element is undefined and bulletFromTheAsset is undefined

and my player don’t move

oh ready the player is already moving, my mistake, but now I don’t know what happens but the enemy entity is upside down but in the editor it is right, observe

the other way around



Please check the setup of the example project carefully. You will see the model of the character is a child entity of the actual enemy AI with all components. This way you are be able to rotate the model in the correct direction.


Question what is the hud and the bullet for?

The hud is an entity with a text element above the character. Here the current state of the enemy is shown. If you don’t want to use it, make sure the attribute is empty. If you’re still getting an error about a missing hud, then this is a bug I need to fix.

The bullet is a trigger entity used to attack the player. It needs the bullet script which you can also find in the example project. This entity should be disabled by default.

I fixed the esc error and the enemy entity rotation error, it seems that the code is like it has it reversed if the enemy entity looks down in the laun looks up a funny error, the bad thing is that I don’t know why The entity is not rigid and the player traps it and, apart from that, it stops. Any solution?
Here I show you a screenshot of my failed attempt

thanks you gave me an idea

OMG the game got totally dark and I got these errors and that’s only because I didn’t select the hud and bullet entities, any solution?

apparently the error is here could you help me I don’t know what is wrong

I suggest to copy the enemy entity from the example project to make sure you have the correct setup. Then you can change the model entity with your own character. Also use the Anim State Graph from the example project so you can easily apply your own animations.

OK I will try it

well the entity moves but the problem is that it does not attack me, what is the problem, I emphasize that there are no errors

Your player entity need a Target tag.

OH I understand

Hello, could you check it, I tried it and nothing happens
this is the link:

As far I can see, your player entity has still no Target tag.