Oct-16-2021, 07:17 PM
Thanks for the answer
![Smile Smile](https://python-forum.io/images/smilies/smile.png)
(Oct-16-2021, 03:59 PM)Windspar Wrote: Avoid global variables like the plagueIs it called global variables if I store some stuff in a module and just import it in almost each module? Because I made something like this and for example i use 'SCREEN' variable in almost every other module. Is it wrong way? Why?
import pygame from game_data import GameData WIN_SIZE = (1024, 768) FRAMERATE = 80 SCREEN = pygame.display.set_mode(WIN_SIZE) SCREEN_RECT = SCREEN.get_rect() MOVE_RATIO = 30 START_TIME = 140 # Time of 'intro' before each level END_TIME = 180 # Time of 'outro' after each level pygame.init() FONT = pygame.font.Font('../resources/fonts/OpenSans-Bold.ttf', 100) MOVE = pygame.USEREVENT # User event for moving enemy pygame.time.set_timer(MOVE, MOVE_RATIO) game_data = GameData() GFX = game_data.textures SFX = game_data.sounds ENEMIES_ARGS = game_data.enemies_args