Spawning
-
@GameCRAZY I don't really understand what you are saying to do, here is what I did
-
@GameCRAZY I don't really understand what you are saying to do, here is what I did
@Stephenn Well, does it work? Tell me if you would like me to make you the project...?
-
@GameCRAZY I don't really understand what you are saying to do, here is what I did
@Stephenn You could use dynamic attributes to store whether an object has already been spawned, assuming you don't need to spawn any more after the objects have moved or been destroyed. For example, you could use combine text to combine the X and Y spawning position with a space in between, and get that dynamic attribute. If the attribute is not equal to 1, spawn an object at that position and set that dynamic attribute to 1. If the get attribute was equal to 1, try again. I think it should be something like this:
It's not the most efficient way because it can loop a lot if you have a lot of the grid filled already, but it's pretty simple and this also lets you set certain areas to be blocked from spawning in. For example, if you don't want an object being able to spawn at 14,12, you can set the attribute "14 12" to 1, and then when something tries to spawn it'll get that attribute, see that it is 1, and pick a different position.It isn't efficient but it is pretty simple behaviours so shouldn't cause too much lag, just make sure you don't run the spawn behaviour more times than can fit in the grid, otherwise it'll get stuck in an infinite loop looking for places to spawn.
-
@Stephenn Give me till Saturday night... I will comment when it is published to the hub.
-
I've created a working one. It simply uses an array with all the possible positions you want the object to spawn (and because of private messaging I have the array of positions @Stephenn wants for their project). The object will move to a random position given from the array, then delete the position from the array. If the array has nothing in it, the object will destroy itself. Here's the link:
http://bit.ly/2qcqa76 -
@Stephenn mine works too: http://bit.ly/2qboXgz
But Aidan's is probably better since it doesn't loop (although you have to enter every position in the array for his). -
@Stephenn mine works too: http://bit.ly/2qboXgz
But Aidan's is probably better since it doesn't loop (although you have to enter every position in the array for his).@Jack8680 entering all the values actually wasn't that hard. Did them all for the first bunch of x values then just copy and paste with a new x value.
-
@Stephenn copy the link and paste it into safari, works for me.
-
@Stephenn sorry, forgot to say they're in the global behaviours (you should put them in an object in your scene, otherwise they load on every scene)
-
Ehm, I guess I won't create an example then. Why do you guys always have to steal my glory XD?
-
@Stephenn Just a joke - it is all good!
-
@Stephenn Just a joke - it is all good!
@GameCRAZY Because I did it first 😝 and I have been PMing stephenn.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login