I have this block breaker type of game. Where you start the ball and then it goes bouncing around, and you have to hit it back with a paddle. Now I want to have God Mode, where user can design a level him/herself. Each block is 1x1 size and there are 4 types of blocks as you can see. I have managed to code instantiating each with different keys(1,2,3,4), but now I have trouble designing them around. They all instantiate in the middle of the screen (0,0), on top of each other, and if the user might instantiate like 200 of them, I worry, the game might lag or something. Because the screen is 16x12. Here’s my code for instantiating these prefabs, what can I do to improve and move them around, save and add next prefab and finally finish it. If they could test, it would be even better.
public GameObject block3hit;
public GameObject block2hit;
public GameObject block1hit;
public GameObject unbreakableBlock;
void Start()
{
}
private void Update()
{
SpawnBlock3();
SpawnBlock2();
SpawnBlock1();
SpawnBlock4();
}
void SpawnBlock3()
{
if (Input.GetKeyDown(KeyCode.Alpha3))
{
GameObject k = Instantiate(block3hit);
k.transform.position = new Vector2(0, 0);
}
}
void SpawnBlock2()
{
if (Input.GetKeyDown(KeyCode.Alpha2))
{
GameObject k = Instantiate(block2hit);
k.transform.position = new Vector2(0, 0);
}
}
void SpawnBlock1()
{
if (Input.GetKeyDown(KeyCode.Alpha1))
{
GameObject k = Instantiate(block1hit);
k.transform.position = new Vector2(0, 0);
}
}
void SpawnBlock4()
{
if (Input.GetKeyDown(KeyCode.Alpha4))
{
GameObject k = Instantiate(unbreakableBlock);
k.transform.position = new Vector2(0, 0);
}
}