Part Four: Laser Defender
There’s been quite a wait between part 3 and part 4 of my Game Dev adventures. I’m learning C programming at university so have put learning C# with Unity to one side for a while. Sadly, that means there is likely to be another gap between this and the next one too. Next is a Plants vs Zombies style game which looks really cool.
This time, we have created a Space Invaders clone called Laser Defender. The player moves a spaceship left and right and fires a laser to take out enemies who move across the screen.
This time, we have delved into:
- Finding game art from creative commons resources – the sprites in this game are by at Kenney at opengameart.org;
- Controlling a spaceship with the arrow keys within boundaries set by Mathf.Clamp and being able to adjust movement speed;
- Creating prefabs for any spaceships and introducing Mecanim animations for their movement;
- Instantiating enemy lasers randomly and player lasers when fired;
- Setting up trigger colliders and sorting layers;
- Adding a star-field with parallax effect using the particle system;
- Keeping score when enemies are destroyed via script.
I haven’t uploaded the game this time as I know the Unity Player plug-in is no longer supported by most browsers, so here’s a peek at how it looks.