Giter Site home page Giter Site logo

-a-steroids's Introduction

Asteroids

An Asteroids game with a size-based twist written entirely in JavaScript and utilizing an HTML5 canvas element to render graphics.

Use the arrow keys to move and the space bar to shoot. When your ship glows green, it is invulnerable to collision; this effect is engaged only when respawning or entering the next level and will end after 2 seconds, so be sure to quickly move out of the way of any nearby asteroids.

With each asteroid you destroy, your ship grows just a bit larger. When your ship is destroyed, your next ship will be normal-sized; you only get 5 ships, so be careful how you use them.

I did not use JQuery for this project, preferring to challenge myself and limit my code to raw JavaScript and simple addEventListener functions; HTML and CSS are only used to influence and scale the size of the canvas. I used the JavaScript Audio object to play .wav files for specific events.

Forgoing the use of sprites, everything in the game is drawn using the canvas and simple lineTo(), fill(), arc(), and stroke() functions. This required significant trigonometry and vector algebra; the ship and its exhaust trail in particular required some tinkering. All asteroids are generated with a random amount of sides between five and eight; this also required significant trigonometry.

In the future, I hope to add in randomly generated powerups to increase fire rate, provide extra lives, engage shields at will, and shrink or grow the ship. I will also attempt to create a scoring system and a table of high-scores to show which players have survived the longest.

-a-steroids's People

Contributors

ryanscottaudio avatar

Stargazers

 avatar

Watchers

 avatar

-a-steroids's Issues

No demo

Please make a github page with demo, it's very inconvenient to download it just to play.
All you need is to go to the Settings and push one button.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.