0.3.0 - Enemies (Week 10)


Don’t Let Them Land 0.3.0

Factoring in the Refactor

Last week was all about getting something on the ground to work with, so I knew there was indeed a game here. This week, I wanted to focus on building on this work and introducing more enemies. I also wanted to adjust the game so that instead of building a score, it becomes more about survival against an endless wave of aliens.

First, though, I needed to rebuild how I spawned enemies. If I were going to have more than one type, then at least I would need to be able to facilitate that behaviour. A bit of a spoiler, though, is that I failed to even do that.

I could lie to you and say this week was a wild success and that everything I tried worked the first time without hassle, but it would be a big old lie. I had a lot of trouble getting what I wanted to work and not because I didn’t know how. I knew a few prefabs would do the trick, but for educational purposes (I think?) I decided to try and learn to do the same thing in a completely different way. The reason I did this was because this other way was supposed to provide me more flexibility and simplicity in building new enemy types, but when the dust settled, I found that I had more complexity and more files than if I had just built a couple of hard-coded enemy prefabs. The lesson? Sometimes the fancy solution, which might work well for a bigger or different game, doesn’t pay off if you have an easier solution. Sometimes it’s better to get something working than to try and overengineer a solution.

Now, don’t get me wrong, as frustrating as this week has been, it was a good lesson, and I learnt plenty of C# and Unity along the way. I did get this alternative solution working, and it’s what is playable in 0.3.0, but it isn’t nearly as clean as I originally thought or intended it to be. There are ways of doing what I wanted to do in better ways, and I’ve explored these in online tutorials in the past, but implementing them in this project was an unnecessary time sink given the intended scale of the assignment. Ultimately, it cost me time that I could have used making more content.

So, what did I get done?

Aliens. We have aliens, baby. Pink alien laser shooting craft from the space beyond the screen, aiming to land on your planet. After all the refactoring, getting these guys in wasn’t too hard, but initially, they were a bit dumb (and not pink) as you can see in Figure 1.

Silly UFO

Figure 1 - Aliens trying to land!!!

Okay, so secretly these cute little falling spacecraft are just the asteroids retextured, but hey, it's a. It was time to give them their own behaviour. Firstly, just giving them the ability to shoot at the planet using the same setup as the player, as they plummeted to the surface, gave them some character and the player more things to worry about.

But our pink aliens are not some dumb fire missiles charging headlong into the planet. They should know how to stop and shoot from a distance, and let’s make them orbit the planet, too, because that’ll look cool and might add some interesting quirks to the gameplay. See Figure 2 for what that looked like initially.

Less Silly UFO

Figure 2 - Aliens learn how to shoot and orbit.

Too Many Lasers

With all these aliens spawning and their lasers firing, it was clear that the player with his turrets was going to be overwhelmed. A shield was needed! A planetary shield was always an intended feature, and now felt like the right time to get a basic implementation of that in. See Figure 3 for the initial mistake I made implementing it.

Silly Shield

Figure 3 - ERROR::// ROBOT IN SPACE > HELP

I’m still deciding how exactly I want the shield to function long term, but for now, it’s a weak boy. It can stop one shot from the aliens and then needs a small time to recharge before it can stop another shot. This works well this week, but it might be a problem for other enemy types next week. So, it, like most other things, will be adjusted as time goes on. Especially given that the aliens need time to bypass the shield in the future to actually land.

You Let Them Land

With the aliens spawning and shooting their little lasers, it was time to have those lasers do something. Initially, I intended to keep the score system from last week for at least a little longer, but keeping track of what was hitting what and how to increase or decrease the score was getting complicated and, frankly, unnecessary. The only thing that mattered was if things were hitting the planet, and that should end the game. So, I removed the score and changed it to track survival time. Then only the planet cared if it got hit by something, and when it did, I paused the game and brought up an end screen with a restart button that reloaded the scene so you could play again. My best score I recorded was 105.96 seconds seen in Figure 4. What did you get?

My best recorded score

Figure 4 - I think I've gotten a 114 before, too!

Now I know that lasers hitting the planet doesn’t quite constitute as letting the aliens land, but for now, it works, and next week, we should have more aliens and a more refined experience so that the aliens have to “land” on the planet for the player to lose.

Feedback

Due to how much time the refactor cost me, I didn’t make the feedback session with anything different from last week. None of the alien or shield mechanics were in yet. However, I managed to get feedback from friends again afterwards. They said they had fun and were suitably surprised by the difficulty spike.

“At 40 seconds I thought I could beat your 105 easily but then it went from 0-100 real quick”

I think this is good feedback for next time, though. Ultimately, I don’t want the game to end so quickly that you feel like it’s impossible. This week and overall, it’s not meant to be a long experience, but it should also leave you feeling like you can do better next time. Unless you are very good at the game, of course.

References

Assets used:

Leave a comment

Log in with itch.io to leave a comment.