TO LOAD THIS CART in Pico-8, type in immediate mode:
load #cs |
Methods of drawing snow have come a long way, haven't they ?
If there's one feature of Pico-8 I have learned about and enjoyed over the years are the two commands ADD and DEL.
With them you can add and delete elements inside an array without having to plug them up with other data or manually skip over them by setting a flag later.
This can especially be seen in my latest offering, "Component Snow."
And it does follow a set of rules.
- The snow falls vertically.
- If it is obstructed, that is there is snow directly beneath it, a comparison is made.
- Can it slide down to the left but the right side is blocked, yes ? Slide down to the left.
- Can it slide down to the right but the left side is blocked, yes ? Slide down to the right.
- Can it slide down either left or right ? Choose a direction randomly and do so.
- Can it not slide down at all ? Draw it then TERMINATE the array element carrying it.
And you can see what happens. Snow falls and it trickles down the edges if there's room for it to do so.
It does not stack itself up in vertical lines but slides down a slippery slope when it can find the chance to. The path of least resistance.
The number to the left shows the current number of active snowflakes. This is the number of snowflakes the computer is keeping track of at the time.
The number to the RIGHT shows the propensity of the snow. Use LEFT and RIGHT arrow keys to change this from a gentle drift to a blizzard.
Some interesting questions to ponder:
- What are the maximum number of snowflakes that can be active at any one time ?
- How would you write your code to ensure that the snow does not fall off the edges of the screen ?
Please enjoy and ...
MERRY CHRISTMAS
[Please log in to post a comment]