Skip to content

Latest commit

 

History

History
21 lines (17 loc) · 1.18 KB

README.md

File metadata and controls

21 lines (17 loc) · 1.18 KB

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.