Initialise an emitted object with random values

I am making a simple clicker game, based off the example provided. When a box is clicked I would like it to explode, sending 5 fragments flying.

Here is the Behaviour of the Box object.

When clicked the box is destroyed, and a Repeater creates 5 fragments each of which is given a Random angle of ejection.

This all works well.

However I’d like each fragment to start with a random Rotation.

If I add Once > Random > Rotation to the shard object, then this literally only triggers once. So the very first fragment gets a random orientation, but all subsequent fragments are identical, with a rotation of 0.

How can I set a random rotation to every Shard object at the moment it is spawned?

Thanks.

1 Like

I’m not sure what your problem could be. If you link to the game I could check it out; I tried doing the same thing here and it works fine

1 Like

Thanks so much for checking my logic.

I am not sure what was wrong, but I closed my browser and came back to the project this afternoon, and the random rotation is working!

Here is a link to my project: https://flowlab.io/game/play/2198869

2 Likes

If you use another random value in the “emit” input, you can use the extractor behavior set to “starting value” to grab that value in the emitted object.

1 Like