Warning!! I’m completely new and I’m a noob so if you get headaches or nausea from stupid questions or by trying to explain something simple to someone and he doesn’t understand it just skip this xD
I’m making a game about a cube that’s trying to avoid other falling cubes by going left or right. How can I make something like a spawn point that the white cubes will fall in a straight line but at different points? This is what the scene loos like, I think you can guess what I want to do.
No one wants to click cryptic links posted by brand new users, no offense. Whatever it is you can just post it directly into the forum.
As for your question, you can just have your spawner place newly instantiated cubes at random x and z coordinates within a certain range.
public EnemyCubePrefab;
public float MinX;
public float MaxX;
public float MinZ;
public float MaxZ;
public float YPosition;
public void SpawnCubeDrop()
{
GameObject newCube = (GameObject)Instantiate(EnemyCubePrefab);
float xPosition = Random.Range(MinX, MaxX);
float zPosition = Random.Range(MinZ, MaxZ);
newCube.transform.position = new Vector3(xPosition, YPosition, zPosition);
}
The above example should instantiate a new enemy cube object whenever SpawnCubeDrop() is called. It will appear at a random x and z coordinate within the bounds of the Min and Max values, and always at the same y coordinate.
If it is a 2D game you’d just skip the Z stuff.
Alright, I’m completely lost right now
What do I need to change the script and could you give me 1 more example, please?