Problems with enemies

I am having a lot of trouble when trying to make an enemy for my 2d platformer Game. This enemy is suposed to Chase you when It detects your presence, but i am strugling a lot to make It work. I have tried to use raytracing to detect the player, but the rays don’t detect anything. I have tried using an object to detect the player, but i cant make It follow the enemy. I have Also tried to do this with the “Distance between two objets” Condition, but i cant make It work. I asked chat gpt for help, but It didnt give me sugestions that work. Basicaly, i cant make It detect the player

I cant show screenshots of the scene events because i erased all the events i had related to the enemy out of frustation.

I would be very grateful if you could help me, because I really don’t know what else to try other than begging for help from more experienced developers.

Hi, can you send a screenshot of your event sheets

Hi …without your events as a starting point it’s really hard to give advice. I was going to suggest using distance between two objects and raycasting and you can also use the platform states of the player to influence the behaviour of the enemy and angle between two objects etc but you need to think about logically what you want to achieve.
Write down on paper what you want to happen and put the the logic together and then try it out…if you’re still stuck then post the events and the hive mind will assist!
If things weren’t working before it’s possibly that there were contradictions in the logic.

1 Like

Thanks for the advice, i Will try to think It better. If i cant figure It out, at least i Will have screenshots of the events to make It easier for others to help me.

1 Like

You can also just refer to X and y of the player ie if playerx less than enemy X and distance between player and enemy less than 300 and player y less than enemy y + 100 and player y greater than enemy y -100 simulate left for enemy

1 Like

This video by Winstreak! is exactly what youre looking for

1 Like

I have finally figured it out. The reason it didnt work was because i was programing the enemy events in a external events sheet, whitout including those events in the scene where the enemy was present. Im embarased it took me 3 days to realise my mistake.

1 Like