I have a sprite mask with the shape of a blood stain
When I kill an enemy that sprite mask appears and reveals the blooded map.
So I want to make my sprite mask have a random size and rotation, but I really don’t know how to do that.
Maybe by code (I’m a noob at code so I’d need a tutorial), or with the particle system?
The particle system looks like the best Idea, but I’m not sure if the particle system could spawn sprite masks.
Doing this by code will be easiest. For random size right after the line that you spawn/Instantiate the sprite:
spriteMask.transform.localScale = new Vector2(Random.Range(0.5f, 2.0f), Random.Range(0.5f, 2.0f));
That will set a random size between 0.5 units and 2 units on the x and y axis, but if you want to keep it square, you should add a float before that line and put the random range method in there, then put that float variable where I put BOTH the random range methods.
For rotation, do the same with random range, but you only need to apply it to the z axis:
spriteMask.transform.rotation.eulerAngles = new Vector3(sprite.transform.rotation.eulerAngles.x, sprite.transform.rotation.eulerAngles.y, Random.Range(0.0f, 360.0f));
That should do it.