Hello,
I’m new to scripting so any help and explanations you can give me will be a massive help.
For a project I’ve been asked to create a function in javascript that loops through an array that makes blocks. In the game, you shoot the block and the block changes colour to red, then yellow, then green then if you shoot a green one the block is destroyed and you lose your points. I need a way to check all the blocks have turned green (or been destroyed) so that the “win” screen can load up.
Sorry if I’ve done anything, again completely new to all this and this is the first time I’ve posted on here.
Cheers.
(Here’s the code for spawning the blocks I mentioned)
for (var row = 0; row < 5; row++)
{
for (var col = 0; col < 5; col++)
{
var latestBlock = Instantiate (block, Vector3(this.transform.position.x + blockWidth*row, this.transform.position.y + blockHeight*col, this.transform.position.z), Quaternion.identity);
blockArray.Add(latestBlock);
yield WaitForSeconds (0.1);