How do I made different AI for a single sprite

Get help using Construct 2

Post » Tue Sep 15, 2015 5:58 pm

Hello, I'm actually new on construct and i'm working on my first game who is a Top-Down Shooter. I created my player, my test enemy with a working AI ( I used pathfinding & FOV, if you want the .capx no problem i don't know how to describe it ) but now i want to duplicate this enemy but there is a problem, the AI doesn't work, some enemies don't recognize the player, please help...
B
2
Posts: 4
Reputation: 158

Post » Wed Sep 16, 2015 12:41 am

if they are two different sprites then copying the code and just changing the enemy sprite in the code to the second enemy sprite.

If the enemies are similar in attributes, how they are killed, then you might want to have the enemy sprite that already works have the second enemy as another animation. Then you just set the animation of the enemy of your choice when it spawns.
B
3
Posts: 4
Reputation: 183

Post » Thu Sep 17, 2015 5:33 pm

Well, i only have one sprite & 1 code for an enemy, (i want it to spawn multiples times) but some enemies can't see the player :/
B
2
Posts: 4
Reputation: 158

Post » Thu Sep 17, 2015 6:15 pm

Ok, I found where was the problem...
But now I have another one, I need to add a "for each loop" BUT when I add it, it says that :

Image

That's my script:

Image
B
2
Posts: 4
Reputation: 158

Post » Thu Sep 17, 2015 6:19 pm

Triggers happen outside of the main engine loop. You can't bury them in a for loop (as warned). "On start of layout" only happens once when the layout is loaded.
Just move your "On pathfinding" out to the top and that should work. Same for "On start..", unless you create Enemies on the fly, then you just do that code at that time.
ImageImageImage
B
71
S
22
G
240
Posts: 3,734
Reputation: 133,994

Post » Thu Sep 17, 2015 6:30 pm

blackhornet wrote:Triggers happen outside of the main engine loop. You can't bury them in a for loop (as warned). "On start of layout" only happens once when the layout is loaded.
Just move your "On pathfinding" out to the top and that should work. Same for "On start..", unless you create Enemies on the fly, then you just do that code at that time.

Thanks for your help, i will try it another day, I don't have time anymore :/
B
2
Posts: 4
Reputation: 158


Return to How do I....?

Who is online

Users browsing this forum: 25games, Artcadev, Ashley, mcscooter, Soluna Software and 28 guests