Episode 17: Obstacles

In the last episode I expanded a bit about enemies, and now I’ll do the same for the second type of entity: obstacles.

Obstacles are like enemies in the sense that the player can shoot them and crash into them. But unlike enemies, obstacles don’t have items, a rarity, or a faction.

AI

They do have AI, but it’s pretty simple. Obstacles get a y velocity so they move past the player, and some of them rotate along the way.

Some obstacles move faster than others. The speed is determine by the base scroll speed and, as with enemies, a multiplier in the obstacle’s preset. Here’s what the code that sets the AI looks like:

Presets

In addition to speed and rotation, obstacles have a few other stats like size, health, invincibility, reward value, and crash damage. The shape of the sprite is also important. Here’s a list of the obstacles I ended up with:

  • Junk: a small, fragile piece of space garbage
  • Wreckage: a large, durable fragment of a destroyed ship
  • Comet: a small, fast space projectile
  • Asteroid: a medium-sized space projectile
  • Meteor: a large, slow, and durable space projectile
  • Explosive: a medium-sized, durable, and somewhat-powerful space mine
  • Frag: a medium-sized, somewhat-fragile, and powerful space mine
  • Detonator: a large, durable, and very powerful space mine
  • Gate: a medium-sized, long, and durable structure
  • Barrier: a somewhat-large, long, and very durable structure
  • Hub: a medium-sized, durable space dock
  • Terminal: a very large, durable space dock
  • Vault: a large, very durable structure
  • Saw: a large, powerful spinning device
  • Nebula: a large, powerful, and invincible space phenomenon
  • Obelisk: a long, powerful, and invincible structure

Purpose

These obstacles serve several functions. First, they provide a threat to the player. Second, the player gets a reward for destroying them. But third and most importantly, they add different settings and challenges to the missions.

By filling some missions with asteroids and wreckage, we can create the apparent aftermath of a fleet colliding with an asteroid belt.

Structures can be used to give the feeling of attacking an enemy base.

We can also use durable or invincible obstacles to build a path that the player must navigate. Some obstacles, like gates, barriers, and spires, are long and narrow, so they are good for making paths. Also, some obstacles that don’t spin can be rotated, which lets us control their shape.

Tune in next time when we talk about the third and final type of entity: drops.

Leave a Reply