Git Product home page Git Product logo

spaceshooter's Introduction

DESCRIPTION

Space shooter is an HTML5 canvas game with momentum conservation developed by me use JavaScript as part of learning programming during a pandemic (covid-19) to stay at home.

GAME MECHANICS

screenshot

Keyboard arrows can be used to control the spacecraft. Laser bullets are fired automatically, and player is not able to control them manually. There are two ways to score points in the game. Player can either shoot up the meteors for 10 points each, or the enemy spacecrafts worth 20 points each. All the enemies and obstacles are being spawned outside of the canvas on the top of the screen, and start their descent towards the bottom in a random manner.

Meteors can be of three different sizes which has an effect on their mass. They also have a random vertical/horizontal velocities and a rotation assigned to them when they are spawned. There are 4 types of enemies with different, predefined artificial intelligence. The blue enemies descent to a random vertical position and then try to crash into the player. The red spacecrafts behave like the blue ones but they are much quicker. The green ones fly from the top to the bottom of the screen without ever changing direction while shooting red laser bullets. Finally, the black enemies are the most dangerous as not only are they as quick as the red ones, but they also perform a random flight across the screen with the final task of crashing into the player, while shooting constantly at the same time.

The conservation of momentum has been incorporated into the game by allowing the meteors to bump into each other. Player's spacecraft can also collide with the enemies or the meteors themselves. All the entities in the game, apart from the laser bullets and power ups, have both the mass and velocities. This way after a collision is being detected, it can be resolved in a perfectly elastic manner. Finally, there are two power ups available for the player to pick up. A shield which will protect him from the enemies for a duration of 15 seconds, and a green bolt capable of decreasing the delay between the player's bullets being shot. Game becomes more and more difficult as the time progress due to the amount of meteros and enemies being spawned every second.

KNOWN ISSUES

It is not possible to play the game using the Internet Explorer web browser due to its lack of support for the currentTime DOM property. There is also no support for the touch events and canvas does not scale properly on smaller screens, therefore it is not really possible to play the game using mobile devices.

CREDITS

3RD PARTY LIBRARIES USED

spaceshooter's People

Contributors

samuelpasaribu avatar lqxu avatar samuelpasariibu avatar

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.