-
-
Save stephengruppetta/f79b58865ed08f2d55e989ec15154796 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# dot.py | |
import turtle | |
import random | |
class Dot(turtle.Turtle): | |
DOT_COLOURS = "#fdb33b", "#6d227a", "#fff3e6" | |
def __init__(self, x, y, size_range, speed_range): | |
super().__init__() | |
self.shape("circle") | |
self.color(random.choice(self.DOT_COLOURS)) | |
self.penup() | |
self.setposition(x, y) | |
self.setheading(-90) | |
self.shapesize( | |
random.random() | |
* (size_range[1] - size_range[0]) | |
+ size_range[0] | |
) | |
self.dot_speed = ( | |
random.random() | |
* (speed_range[1] - speed_range[0]) | |
+ speed_range[0] | |
) | |
def fall(self): | |
self.forward(self.dot_speed) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment