Help. As a sprite performing an action separately.

Get help using Construct 2

Post » Sat Aug 04, 2012 10:44 pm

Hello Friends Scirra.

I have a problem, like the image below (https://www.dropbox.com/s/yj0qiz64e0c69l8/Exemplo.png). The enemies of my games, attack when the distance between them and the player is less than 100. (https://www.dropbox.com/s/j7ibc3idwi5kolw/ExemploCodigo.png)

But all the enemies created (spawn object) perform the action based on the distance of the first enemy, not individually (https://www.dropbox.com/s/pmqbxqfpr6rxut0/Exemplo1.png).

How can I solve this?



Sorry for the horrible english .... ^_^x
B
37
S
8
G
4
Posts: 85
Reputation: 5,099

Post » Sun Aug 05, 2012 12:07 am

I can't really think at the moment, but I know you have to have it so somehow the enemy is in the condition part, so it picks the individual enemy instead of all of them.

Because your code is saying when "player" gets in range of any enemy, all of the enemies are going to attack.
B
13
S
3
G
1
Posts: 44
Reputation: 1,152

Post » Sun Aug 05, 2012 12:35 am

You should probably add a "For each" loop. This will loop through each enemy, checking them individually.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Sun Aug 05, 2012 5:07 pm

Thank you friends, For each solved the problem.
B
37
S
8
G
4
Posts: 85
Reputation: 5,099


Return to How do I....?

Who is online

Users browsing this forum: Pandadoor, Sotir31 and 30 guests