Enemy Everywhere
As the game progresses to infinity and beyond, I decided to do a rework of the enemy spaceships.
We’ve gone from one type of enemy to four, but not only their appearance changes but also some’s behavior. Let’s not waste time and move on to introductions.
The basic enemy has not changed in behavior but only in shape, I decided to diversify the type of laser between player and enemies, I applied it to all enemies afterward.
We also have the more cautious brother of the basic enemy, the shielded enemy, which is identical to the first but you need at least two shots to kill him.
Inspired by the great arcade classics, it seemed a must to create an enemy that had more life but gave much more points than the others.
Be careful because it doesn’t come towards you but passes horizontally over the field. When you see it, it is better not to let it escape.
Finally, we have a type of enemy that it is better not to approach because he has an easy accelerator. Be careful not to get hit by his kamikaze attack.
For the management of the various enemies, I used the Enemy class that I had initially created. Managing the types of behavior with a switch-case according to the type defined by an Enum
If I had to implement it from scratch but I think I would use a system of inheritance with the base enemy class and its possible extensions and override methods.