Skip to content

A shooting game experiment using some functional programming principles

Notifications You must be signed in to change notification settings

Khaleed/ShootEmUp

Repository files navigation

ShootEmUp

Why?

  • Pick up higher-level problem solving skills.
  • Dive deeper into writing functional JavaScript using the better parts of ES2015/ES2016.
  • Make a real-time action game from scratch.

Game Logic

  • This is a bare-bones implementation of the classic shooting game Space Invaders.
  • The player must shoot all the invaders before they reach the player to win.
  • The invaders randomly keep shooting and slowly move towards the player.

Approach

  • Drawing on the canvas, the game loop, and collision detection are all done without any libraries or frameworks.
  • This project was written in a functional programming style using ideas borrowed from Clojure and Elm Architecture.
  • It's not purely functional because of the limitations of JavaScript and I/O being inheritently impure.
  • Instead of deep cloning objects and arrays, one could use a persistent data structure library such as MORI.

Play

Play the game on http://Khaleed.github.io/ShootEmUp

Installation

Dependencies

To get dependencies

npm install

Install Webpack globally

npm install webpack-devserver webpack -g

Server

To serve at http://localhost:8080/webpack-dev-server/

npm run watch

Build

To build when NODE_ENV environmental variable is set to production

npm run deploy

Contributors

I would like to thank the following awesome people:-

  • David Hargat for showing me how to make JavaScript games
  • Sal Becker for teaching me functional programming
  • Diego Berrocal for introducing me to JavaScript ES2015
  • Ralph Barton and Pierre-Yves Baccou for helping me with the computer animation physics
  • Marijn Haverbeke, the author of Eloquent JavaScript, for helping me refactor to make the game even more functional.

© github.com/Khaleed

License

ShootEmUp is released under the GPL-3.O License.

About

A shooting game experiment using some functional programming principles

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published