How do I Stop Enemies Spawning Near Me

Get help using Construct 2

Post » Mon Aug 11, 2014 9:38 am

Hi,

I am 14 years old and creating a game for my school assignment. My game is about Crocodile Dundee and you need to run around killing crocodiles and gaining points. I have one problem though, since my enemies are set to spawn at a random X axis (but a fixed Y axis) this means they spawn anywhere, even under me, making this game nearly unplayable.

Thanks :)
B
2
Posts: 1
Reputation: 150

Post » Mon Aug 11, 2014 10:05 am

Check if the enemy.x is within range (say 50 pixels, or width of player, etc.) of player.x, and do another random respawn if it is
e.g. if abs( player.x - enemy.x) < 50 -> try another spawn

Or just check if the sprites are overlapping, and do another random respawn if they are (keep the enemy invisible until then).

There are other ways too, like not spawning on the player's location in the first place..
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596


Return to How do I....?

Who is online

Users browsing this forum: Apollo14, Lordshiva1948, Meqara, mrkaio, Yahoo [Bot] and 1 guest