def debugControls(action, surface): """handles debug controls. Ex: createActor""" if action == 'createAnything': try: tile = random.choice(lists.all_tiles) pos_chosen = random.choice(tile.coords) actors.spawnAnything(surface, loadImages.loadImages( r'./art/man/', 'png'), pos=pos_chosen) except IndexError as e: print str(e).upper(), 'grid\'s probably not made, right click and try again'
def init(): '''initializes screen''' global screen, background_surface #initializes pygame PG.init() #starts the screen screen = PG.display.set_mode((constants.WIDTH, constants.HEIGHT)) #set Icon, may not work off windows icon = loadImages.loadImages(r'./art/man/', 'png') icon = icon[7] PG.display.set_icon(icon) #fills the screen with a color screen.fill(constants.BACKGROUND) #loads the background image background_surface = loadImages.loadImages(r'./art/backgrounds/', r'pond.png', (screen.get_rect().w, screen.get_rect().h)) background_surface = background_surface.convert() screen.blit(background_surface, (0, 0)) #loads joyticks to gamePad list controls.initJoysticks() global imageList imageList = loadImages.loadImages(r'./art/man/', 'png') #create a first Anything actors.spawnAnything(screen, imageList, (400, 400)) actors.Shooter(lists.ANYTHINGs[0]) PG.display.flip() return screen