I were making a simple game in pygame and I realized I need a bunch of markers, counts and all sorts of global staff. So I decided to define a class and use it like this:
class Staff(): def __init__(self): self.modes={'menu':True,'spawning':False,'sprite_change':False} self.timer=pygame.time.Clock() self.tick_count=0 and in my game loop I just give one variable to all my functions:
def main_loop(): staff=Staff() while not done: update_positions(staff) clear_background(staff) draw_sprites(staff) I know this method is working and quite convenient (for me), but I wonder how's this going to affect speed of my game, may be I'm doing something horrible? Many thanks for answering.