Skip to content

r0naaal/falling-sand-simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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!

About

Simple falling sand simulation with Swing GUI

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages