How do I make different AI for same sprites?

Get help using Construct 2

Post » Mon Feb 29, 2016 4:44 pm

Well, as the title says, I want to know how to make different AI for each enemy, I have the AI, the problem is that all enemies that are the same sprite move always together, I mean, the AI is simple, its just like "choose(Move left, Move Right)" and then, "Wait (1, 2, 3, 4, etc... seconds)" and then "choose(Move Left, Move Right)" again, its like a loop, the problem is that all enemies move the same direction and they all wait the exact same time, what I want is to have same sprites but they have their own pattern.

PS: Srry if you dont understand at all, Im not english :p
B
4
Posts: 18
Reputation: 234

Post » Mon Feb 29, 2016 5:00 pm

Just a few quick thoughts
You have a lot of different options.

e.g. give the enemies an instance variable like enemyAItype
or all enemys have a unique UID - you could ask for that number and for every number multiple of 3 (modula) use this AI
or move slower faster with random generated number
or don't spawn them on the same time

  • System > On start of layout | system > load game from slot "brain"
  • System > On load failed | system > scroll to obj_Forum
B
17
S
8
G
5
Posts: 340
Reputation: 4,707

Post » Mon Feb 29, 2016 9:11 pm

TheCreepy12 wrote:Well, as the title says, I want to know how to make different AI for each enemy, I have the AI, the problem is that all enemies that are the same sprite move always together, I mean, the AI is simple, its just like "choose(Move left, Move Right)" and then, "Wait (1, 2, 3, 4, etc... seconds)" and then "choose(Move Left, Move Right)" again, its like a loop, the problem is that all enemies move the same direction and they all wait the exact same time, what I want is to have same sprites but they have their own pattern.

PS: Srry if you dont understand at all, Im not english :p


You are missing a "For each Enemy" some where.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,838


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 18 guests