How do I allow an enemy to spawn anywhere but player's x &y

Get help using Construct 2

Post » Sat Feb 21, 2015 4:06 am

I'm trying to make an event so that an enemy may spawn anywhere on the map except the player's current X any Y position but i'm not sure how to. Can anybody help me? Thanks in advance!
B
12
S
3
Posts: 129
Reputation: 1,131

Post » Sat Feb 21, 2015 4:54 am

use a function to spawn the enemy, then , after the spawning action, check for the position... if its teh same of the player call the function again.....

the loop will continue until the spawned enemy is not on the same position than the player
Image
B
57
S
13
G
6
Posts: 271
Reputation: 12,103

Post » Sat Feb 21, 2015 5:58 am

Something like this?

System: Random(1) = 1
create object at player.x+100+random(1000)

Else
create object at player.x-(100+random(1000))

and same for y
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Sat Feb 21, 2015 9:18 am

edit : nah, I made a mistake :D
B
12
S
7
G
7
Posts: 450
Reputation: 4,276


Return to How do I....?

Who is online

Users browsing this forum: adamebastin, plinkie and 9 guests