# Spawn Enemies in the near of the Player

Get help using Construct 2

push
B
11
S
2
Posts: 93
Reputation: 917

### » Mon Oct 21, 2013 3:50 pm

+ System: for each order by distance (random.X(copy your current random calculation), random.Y, platform.X, platform.Y)
- Platform: Spawn Enemie or whatever
- System: Stop loop

But please forward of asking to much try it by your own, you will learn much more ;)
B
15
S
6
G
6
Posts: 512
Reputation: 5,555

### » Mon Oct 21, 2013 7:47 pm

For Each (Ordered) ?
And then Use Objekt = Platform
Order = descending ?
And Expression = (random.X(copy your current random calculation), random.Y, platform.X, platform.Y)

???
B
11
S
2
Posts: 93
Reputation: 917

### » Tue Oct 22, 2013 12:00 pm

Bump - Sorry for that, but its my last question for finishing my game.
B
11
S
2
Posts: 93
Reputation: 917

### » Thu Oct 24, 2013 8:11 pm

@Darklinki

Can you help me one more time ? I dont understand it.

For Each (Ordered) ?
And then Use Objekt = Platform
Order = descending ?
And Expression = (random.X(copy your current random calculation), random.Y, platform.X, platform.Y)

Or what did you mean?
B
11
S
2
Posts: 93
Reputation: 917

### » Fri Oct 25, 2013 7:54 am

If have done something like this before:

+ Every 2 seconds
++ For each platform order by distance ascending (distance(player.x, player.y - Variable, self.X, self.Y))
-- Platform Spawn Enemie on Imagepoint(0)
-- stop loop

+ = Condition
- = Action

Variable = A number which says how much the platform with the enemie must be away from the player

Is it clear now ? Darklinki2013-10-25 10:28:59
B
15
S
6
G
6
Posts: 512
Reputation: 5,555

### » Fri Oct 25, 2013 11:42 am

I have it so, but it dont works really well.
self.X and self.Y dont work say the System. So I changed it to:

(distance(player.x, player.y - Away, Platform.X, Platform.Y))

Away = Variable
Platform.X and Y were before self.X and Y but i dont know why I cant add "self".

@Darklinki
B
11
S
2
Posts: 93
Reputation: 917

Previous

Return to How do I....?

### Who is online

Users browsing this forum: dop2000, suman882 and 7 guests