Clean EnvironmentΒΆ

We are going to start keeping our constants and useful variables in a separate file.

  1. Create a separate file, call it “settings.py”
  2. Put in the following variables
1
2
3
4
5
6
7
8
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
RED = (255, 0, 0)
WINDOW_SIZE = (700, 500)

SPEEDX = 5
SPEEDY = 5
  1. Anytime you have new constant variables, they should be put into here.
  2. Inside your game file, you should put the following:
1
2
3
from settings import *
# if the above breaks, type:
# from .settings import *