Ενότητα 6 - Τμήμα 1 - Επαναλήψεις και κινούμενα σχέδια
6.1.4 - One of many snowflakes
If you don't have snow_flakes_1 and snowList opened inside Thonny, find them inside your project's folder and open them. In case that you don't have them you can download them from here and here and save them inside your project's folder.
In the snow_flakes_1 script remove lines 30 and 31 from initialization area that were used to create a random pair for the one snowflake.
Copy the commands lines 8 to 12 from snowList script and paste them inside snow_flakes_1 script in the initialization area, around line 30 (outside the main loop).
Save the script as snow_flakes_1a
If you run the script it creates one snowflake on the coordinates of the last pair of the list. Why?
What if we wanted the snowflake to be drawn on the coordinates of the first pair?
How can we view the coordinates of one of the pairs?
Stop the snow_flakes_1a script and in the CLI area write
>>> snow_list[0]
or
>>> snow_list[1]
Now change the draw command around line 59 to
pygame.draw.circle(screen, WHITE, snow_list[0], 2)
With this change every time the script runs it creates 50 pairs of coordinates and uses the first pair to draw one snow flake.
What change we should make to draw all the 50 snowflakes;