svader0 / sandbox

Falling Sand Game Built in Rust
0 stars 2 forks source link

Change water (and sand) update function #13

Open svader0 opened 6 months ago

svader0 commented 6 months ago

Currently, the water update function (and maybe sand too! I forget) picks a random direction to move if there's an equal likelihood, aka there's air on either side. This is terrible for performance. Instead, have it pick based off whether the frame number is even or odd. We'd have to implement a frame counter int for this that resets when it reaches the maximum int value.

For example, if the frame number is 100439, go left, since its odd. if it was 100440, then we would go right.