Tuesday, October 16, 2012

Create a Simple Asteroids Game Using Component-Based Entities

In the previous tutorial, we created a bare-bones component-based Entity system. Now we’ll use this system to create a simple Asteroids game.

Final Result Preview

Here’s the simple Asteroids game we’ll be creating in this tutorial. It’s written using Flash and AS3, but the general concepts apply to most languages. The full source code is available on GitHub.

Class Overview

There are six classes:
  • AsteroidsGame, which extends the base game class and adds the logic specific to our space shoot-’em-up.
  • Ship, which is the thing you control.
  • Asteroid, which is the thing that you shoot at.
  • Bullet, which is the thing that you fire.
  • Gun, which creates those bullets.
  • EnemyShip, which is a wandering alien who’s just there to add a bit of variety to the game.
Let’s go through these entity types one by one.

The Ship Class

We’ll start with the player’s ship: [...]

Read more: Create a Simple Asteroids Game Using Component-Based Entities

No comments:

Post a Comment