An open API service indexing awesome lists of open source software.

https://github.com/r0naaal/falling-sand-simulation


https://github.com/r0naaal/falling-sand-simulation

falling-sand java swing-gui

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

          

# Falling Sand in Java (Swing)

This is a simple "falling sand" simulation written in Java using Swing for the GUI. The project was inspired by the famous YouTube channel "Coding Train", which featured a similar simulation built with a JavaScript graphics library. Unlike the JavaScript version, which could rely on built-in physics and rendering, this Java version required implementing the sand physics logic from scratch.

## About

I translated the core ideas from the JavaScript code to Java, and at the time, I was only familiar with Swing for building graphical user interfaces, so that's what I used here.

## How it works

- Click or drag the mouse to place colorful sand particles.
- The sand falls and interacts with other particles, simulating gravity and basic physics.
- The simulation runs in real-time with a simple animation loop.

## Getting Started

1. Clone or download the repository.
2. Compile the Java files in the `src` directory.
3. Run the `App` class to start the simulation.

---
Enjoy experimenting with the falling sand and feel free to fix or modify!