The Gravity Game Prototype is a simple JavaScript application I created to quickly test a game idea: gravity based gameplay. I decided to do this because JavaScript made it easy for me to experiment with quick changes so that I could determine if and how this game idea would work.
The game is essentially about manipulating the trajectory of little red squares by placing circular gravity wells that will pull on the squares. You can click on the scene to add and remove gravity wells. I had played around with various methods of calculating gravity before finally landing on simple Newtonian-like gravity.
The game includes a simple set of repeated routines that are called at a set interval to create real-time physics simulation. Every frame, all the objects are updated and the canvas is redrawn. There is a column of information on the side of the page that shows the value of loads of variables for anylsis and debugging.