36. HaxePunk shooting game: Source code

2014-10-07

HaxePunk shooter game source code

Over the past 11 days I've been writing a tutorial series on creating a shooter game using Haxe, OpenFL and HaxePunk framework.

This is the final post, which contains links to the full source code and assets, as well as links to separate tutorial parts.

After following all the tutorial parts you will end up with a fully functional shooter game.

This aim of this tutorial series was to acquaint you with the basics of almost every aspect of the HaxePunk framework.

Let's take a look at the list of features that our game now has:

  1. Player's ship can be moved using the arrow keys.
  2. Shoot by holding the space bar.
  3. Destroy enemy ships for score.
  4. Colliding an enemy ship results in a life loss.
  5. The game is lost when there are no lives left, and can be restarted using the enter key.
  6. The game can be paused at any time using the P key.
  7. The game stores player's highscore locally, so it is saved even if you close and re-open the game.
  8. Power ups can be collected for additional lives.
  9. The game has stereo audio effects.

All of the source code and assets can now be found at the GitHub repository.

If you want to follow the step-by-step guide on creating this game from scratch, check out the links below.

You'll firstly need to install HaxePunk. The whole process is described in this tutorial.

The tutorial series consists of 11 parts. Here they are:

  1. Project base, texture packing using Atlas, movement, debugging
  2. Shooting
  3. Destroyable enemies
  4. Enemy health and particles using Emitter
  5. Score display
  6. Stereo sound effects using Sfx
  7. Pause the game
  8. Player's life counter
  9. Losing and restarting the game
  10. Powerups
  11. Saving Highscore locally using Data

Enjoy!