[AI] Individual AI per entity

Get help using Construct 2

Post » Sat May 25, 2013 6:51 am

Is there a way to possibly add logic to a single enemy instance and have them all act independently?

This is a continuation of the following open questions:

http://www.scirra.com/forum/topic55344.html

http://www.scirra.com/forum/topic68306.html

I can't get the enemySprite to act differently per sprite. They all react the same way.

Here is the logic

B
4
Posts: 24
Reputation: 325

Post » Sat May 25, 2013 7:30 am

Well, all of enemies act in the same way as long as they use similar actions.

So, you can create 2 types of enemies and define different conditions and actions for them, or you can define different actions for the enemy and then set the enemy to randomly choose one of the actions?
B
10
S
2
G
3
Posts: 36
Reputation: 3,315

Post » Sat May 25, 2013 7:39 am

Thanks Gamer.

As an added note you can play the game with the updated logic here:

http://skyrunner.kissr.com

I've actually updated the logic using something i saw here:
http://www.scirra.com/forum/homing-missile_topic50171.html

Here is the updated logic. It's somewhat working now.

ephrisian2013-05-25 08:26:35
B
4
Posts: 24
Reputation: 325

Post » Sat May 25, 2013 8:39 am

You'll need to at 'for each enemySprite' loop and put your actions inside that. Then it will evaluate the results for each individual enemy, right now it's handling them as 'groups' and it probably does not work quite as you'd want it to :)
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Sat May 25, 2013 1:02 pm

I'd suggest using Families. Add Enemy family, and insert sprites representing an Enemy. Then define the unified Enemy action and conditions for the family. If you'd like to modify one of the family member, just add a different action and condition to it. So now you have a unified behavior and also a unique one.
B
21
S
5
G
5
Posts: 58
Reputation: 5,232

Post » Sun May 26, 2013 3:37 am

I'm not sure how to implement Families in the Free Edition. However I did start using the "For Each"

The updated .capx is here: https://dl.dropboxusercontent.com/u/88974109/Skyrunner.capx

Any assistance with optimizing the code would be greatly appreciated.
B
4
Posts: 24
Reputation: 325

Post » Wed Sep 11, 2013 9:03 pm

the capx link is down.. please someone reupload
B
27
S
7
G
3
Posts: 299
Reputation: 4,521


Return to How do I....?

Who is online

Users browsing this forum: Rezzon71, tarek2 and 25 guests