[SOLVED] Loop and Instances

Get help using Construct 2

Post » Sun May 17, 2015 1:06 pm

I have 2 Sprites, named "Enemy" and one sprite named "Player":

I have this code:

System>For each "Enemy"
    System>distance(Enemy.x,Enemy.y,Player.x,Player.y)


How can i capture the X and Y of the instance i want and not just the first one



[SOLVED]


System>For each "Enemy"
    System>distance(Enemy(loopindex).X,Enemy(loopindex).Y,Player.X,Player.Y)
Last edited by liev04 on Sun May 17, 2015 1:41 pm, edited 3 times in total.
B
4
Posts: 9
Reputation: 214

Post » Sun May 17, 2015 1:12 pm

Make an array to capture the x and y of each. I can't make a link at the moment, but check out "arrays" in the manual or tutorials.
B
13
S
5
G
4
Posts: 139
Reputation: 2,586

Post » Sun May 17, 2015 1:40 pm

Thanks, i will try that
B
4
Posts: 9
Reputation: 214

Post » Sun May 17, 2015 4:08 pm

Nice job! :)
B
13
S
5
G
4
Posts: 139
Reputation: 2,586


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, Blendi1223 and 45 guests