More Like Space Invaders

Hi… I wanna know how I can make it more like space invaders… if I create two or more line of enemy ships, how can I make only the first line to shot… leave the bottom lines to shoot only when the enemy right in front of them are destroyed?

Hmmm I’m not sure what the correct way of writing it would be, but you would need to create a relationship between the gameObject the script is attached to and the GameObject you’re referring to.

Then after you’ve successfully made a relationship (it would be a bool i believe) between the 2 objects (I suggest start by print(“Enemy in front of me is gone”) then you could create a method to replace the printed text which calls a shoot method.

Then for creating the lines like space invaders you would manually create the spaceship but have a public GameObject variable which would be a spawn point of the enemy in front of it.

I could be 100% wrong but that’s how I would think it’s done :smiley:

Privacy & Terms