GameDevHQ Crash Course Day#4 It’s raining cubes!
Beginning 2D space Shooter-Enemies
Today I went through making some enemies and having them come down from the top of the screen, along with having my lasers and player interact with them in relevant ways.
I came up with an issue during the enemy collider set up that I could not figure out. I ended up working in a invincibility timer using the time.Time mechanics previous left unused for firing as I couldn’t work out why my player was consistently taking 2 instances of damage every time it collided with the enemy, it would also keep going into -1 health despite the player and enemy supposedly destroying themselves on the initial hits. Then when I was cleaing up code and unity for the next part and I found the issue.
So when I first made the player box, I automatically placed a box collider on it, then following the tutorials I mindless added one when the tutorial did as well, this is what was causing my 2 instances of damage to happen!
Beginning 2D space Shooter-Enemy Spawning
Way too many cubes!
Got back into Coroutines pretty quickly this time, did play around with spawning multiple sets on enemies also added it to the update method for fun, spawning a new coroutine every update frame is definitely not what you want to be doing.
Also added a spawn managing container for the enemies to spawn into so that they do not clutter the hierarchy of unity so can keep that a bit cleaner. Thought about adding one for the projectiles, but will hold off on that for now in case the tutorial wants to group them another way and I have already got a way of removing laser fire when it leaves the screen.