Move object to a random instance

Get help using Construct 2

Post » Wed Jan 02, 2013 10:01 pm

Hi all,

I recently discovered construct. I'm trying to figure out how to make enemies spawn at a random instance of an object.



I've managed to do this through a variable that is randomly generated every x seconds. The enemy sprite teleports to one of the pink squares.



What I would to do now is have the enemy sprite avoid a square when the player is overlapping it.
I'm having a hard time coming up with a solution for this.

Is there perhaps a way to make a reference to an instance variable instead of the UID?



Here's the .capx file:
https://www.dropbox.com/s/qy18prn693ed5nd/Teleporting.capx
Xypo2013-01-02 22:08:31
B
3
Posts: 6
Reputation: 287

Post » Wed Jan 02, 2013 10:17 pm

It's actually a bit easier to pick a random object to spawn from, you can just do something like this:

PickRandomSpawn.capx (r114)

I'm not entirely sure what you mean by "have the enemy sprite avoid a square when the player is overlapping it", I assumed you meant the enemy shouldn't spawn where the player is overlapping, is that right?
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Wed Jan 02, 2013 10:30 pm

That's indeed what I meant.

This is perfect, thanks for the help!
B
3
Posts: 6
Reputation: 287


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot], YoHoho and 18 guests