-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path010_1stsNoMore.py
More file actions
22 lines (19 loc) · 952 Bytes
/
010_1stsNoMore.py
File metadata and controls
22 lines (19 loc) · 952 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 1sts are fun but at a certain point we need to move on and just switch speeds.
# This time is now, in this example we will mix our rectangles with images and
# use a few loops to have more fun, for example if we want to generate a random
# forest, in code.
# remember we have a nice colors.py file, let's use it and just not think too
# much about redefining colors ourselves, read colors.py to know what is available
# please use python3 -m pgzero mySource.py to run when import local modules
try:
from colors import *
except ImportError:
raise ImportError('please use the python interpreter directly, pgzrun has issues with local module imports: python3 -m pgzero 010_1stsNoMore.py')
BOX1 = Rect((20,20), (100,100))
BOX2 = Rect((40,40), (200,200))
def draw():
screen.draw.rect(BOX1, RED)
screen.draw.rect(BOX2, BLUE)
for i in range(42):
BOX = Rect((20,20),(100+(3*i),100+(3*i)))
screen.draw.rect(BOX, PURPLE)