Skip to content

A recreation of the classical asteroids game with javascript

Notifications You must be signed in to change notification settings

jwhite510/asteroids

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

asteroids

The classic asteroids 2-D space game remade in javascript with color, explosions, and full simulation collision physics.

How to Play

WASD keys are used for movement. Left click fires a missile which will follow the mouse position. Right click fires a missile which goes straight.

Collision Physics

Each body (your ship, the missiles, asteroids) carries momentum and is accurately simulated with collision physics.
ui: initial velocity
vi: final velocity
mi: mass

Elastic Collision

v1 = [(m1 - m2) / (m1 + m2)]u1 + [(2 m2) / (m1 + m2)]u2
v2 = [(2 m1) / (m2 + m1)]u1+[(m2 - m1) / (m2 + m1)]u2

Conservation of Momentum

m1u1 + m2u2 = m1 v1 + m2 + v2

Installation

To play the game, clone the repository into a your local folder and open the html file in a browser.

About

A recreation of the classical asteroids game with javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published