DEV Community

Cover image for ¡Gasteroids! 👾 + ☄️
Miguel Manjarres
Miguel Manjarres

Posted on

¡Gasteroids! 👾 + ☄️

Hi there! 👋🏼
This weekend I decided to take a break from coding... by coding a mini-game! Yeah I know that isn't exactly "taking a break", but it was actually pretty fun to make.

I originally wanted to make something similar to Galaga, but the work that would have required would have defeated the purpose of the whole activity, so I made asteroids as the "enemies" instead, hence the name of the game.

Here's the end result:
game_gif

Both the code and the game itself are uploaded to GitHub so head over there if you want to take a look!

GitHub logo DevTony101 / gasteroids

A simple javascript game inspired by Galaga and Asteroids. Made using p5.js

Gasteroids 👾 + ☄️

License: MIT Made Using: P5JS

Preamble

A mysterious horde of asteroids had been released upon Earth and unleashed terror among its inhabitants. You, an awarded space commander, had been chosen to protect Earth by destroying all the asteroids before they hit the planet!

Play here.

Game mechanics

  • Your misssion: Destroy as many asteroids as you can! If an asteroid goes past the bottom border of your screen you will lose a heart point! The number of heart points you start the game with are conditioned by the game's difficulty.
  • Moving: You can move your ship by moving the mouse along the x-axis.
  • Shooting: You can activate your laser gun by clicking on the screen or pressing the space bar. The number of "bullets" you can fire at a given time is conditioned by the game's difficulty.
  • Exiting the game: You can press the [ESC] key at…

Comment down below what your final score was!
Can you beat mine of 6720? 😉

Improvements

The game was made using p5.js, and the code isn't too complex (I hope), so if you are a beginner who is looking for some fun project to work with or you just have some hours to spare, here's a list of improvements you could make to this game:

  • Make the spaceship explode when an asteroid hit it
  • Give the spaceship some special super-power based on the score
  • Give the spaceship an extra-live based on the score
  • Give the spaceship some powerup by exploding an "special item"
  • Add a bossfight (A big asteroid that requires a set number of hits maybe?)

You can clone the repo so you can add this features and, if you'd like your changes to be in the main game, you can make a pull request.

Thank you for reading! If you have comments and/or suggestions to make, please leave them down below.

See you next time 👋🏼

Top comments (0)