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
- Host: GitHub
- URL: https://github.com/r0naaal/falling-sand-simulation
- Owner: r0naaal
- Created: 2025-06-30T04:27:05.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-06-30T05:25:06.000Z (3 months ago)
- Last Synced: 2025-06-30T06:29:07.232Z (3 months ago)
- Topics: falling-sand, java, swing-gui
- Language: Java
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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!