Vexal

2D Gravity Room

Gravity Room - Description

Overview

The Gravity Room was my first project in a real programming language -- Java. The project created a window with several 2D balls contained inside of it. The user could press a button activating gravity. The balls would fall to the bottom of the window and bounce off of each other.

The most difficult part of this project, at that point in my experience, was learning how to use Java Swing to draw graphics, and learning how to handle the physics of two balls colliding and bouncing off of each other. It was also difficult to figure out how to handle balls penetrating when a collision occurs, and finding a simulation state where balls are no longer penetrating after a collision. To accomplish this, I took a naive approach and perturbed penetrating balls apart until they were no longer penetrating. This still did not completely fix the issue when multiple balls were resting on top of each other, but the solution worked well enough for a first project.

MS Paint Reproduction of Gravity Room UI

Gravity Rom

I lost the original Java files for this project, so I have created this MS Paint version of the program. This MS Paint version is not actually a program; it is a picture of what the program looked like.