ScratchData LogoScratchData
Back to GDOR11's profile

DLA with a few enhancements

GDGDOR11•Created June 19, 2024
DLA with a few enhancements
3
2
31 views
View on Scratch

Instructions

Particles randomly move until touching a stationary particle. Over time particles form a tree-like fractal shape.

Description

first difference: instead of spawning a ton of particles at once, this version just spawns a single particle at a time, which means there is no risk of two particles intersecting each other second difference: instead of choosing a direction to go and bouncing off the edges until the particle collides with a color, this version calculates the distance to the DLA and advances that distance in a random direction, both of these are done every tick. Sort of like ray marching, but not really. All this means that I had to store all particles that already belong to the DLA in a list and then check against all of them to see which one is the closest, and this is pretty inefficient, especially when the particle size is 1. It is possible to use a quadtree to speed this up, but actually doing that in scratch is a sign you truly hate yourself. and, in fact, the way that all this is being done in this version is the most accurate according to the definition of a DLA if you consider brownian motion to be a random walk in a 2D continuous plane third difference: since I needed to know the radius of the particles in pixels, I changed the size of the sprites so that their radius is 1 pixel at 100% size, which made it possible to calculate everything properly

Project Details

Project ID1039248236
CreatedJune 19, 2024
Last ModifiedJune 19, 2024
SharedJune 19, 2024
Visibilityvisible
CommentsAllowed

Remix Information

Parent ProjectView Parent
Root ProjectView Root