Clean EnvironmentΒΆ
We are going to start keeping our constants and useful variables in a separate file.
- Create a separate file, call it “settings.py”
- 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
|
- Anytime you have new constant variables, they should be put into here.
- Inside your game file, you should put the following:
1 2 3 | from settings import *
# if the above breaks, type:
# from .settings import *
|