2.2.4 Cycle 4 - Creating Enemies

Design

Objectives

In this cycle I aim to be able to add the enemy ships to the top of the screen and for them to move downwards, and whilst doing this they will spawn in patterns occasionally, with other ships around them.

Using patterns will make the game more immersive as it adds another layer to the game where the player may recognise patterns and use this to their advantage to play more strategically.

Usability Features

Key Variables

Variable Name
Use

switchXspawn

This is the indicator that tells which X spawn to use.

switchToNewPattern

This indicates which pattern to use ( 0 , 10, 20, 30).

enemyXSpawn

These are different base places to use on the screen.

Enemy_X

This is the enemies x coordinate from enemyXSpawn.

Pseudocode

Development

Outcome

Challenges

It was very challenging to work out the logic behind the spawning of the enemies, and how to implement different patterns of the different waves of enemies. This was challenging as I didn't just want to use a json file to set where each enemy would be, I wanted it to be arithmetic based, so that it would adapt to different resolutions and widths of the game, which a json wouldn't be able to do.

From this I thought that the best way to do this would be to have a set of different base places the enemies would spawn from, and then I would add or subtract to that to create patterns.

This method worked suprisingly well when I tested it and I'm really proud of how it worked, as it took a long time to create and think up of.

Testing

During testing I found that the pattern worked really well after many hours of trying different tweaks to the method.

Tests

Test
Instructions
What I expect
What actually happens
Pass/Fail

Spawn enemy

Simply begin the game.

The enemies should begin spawning in, and there will be a range of basic patterns that you will see as the game progresses

The enemy doesn't appear

Fail

Spawn enemy

Simply begin the game.

The enemies should begin spawning in, and there will be a range of basic patterns that you will see as the game progresses

As expected

Pass

Evidence

Enemies spawning in, with one of the patterns beginning to form at the top of the screen.

What Next?

  • Next I'm going to implement sounds into the game to make it more immersive and realistic

  • Sound will also allow the player to know when they've died and when they shoot

Last updated