def run_game(): # Init all of the pygame code pygame.init() # Set up a tuple for the screen size (horizontal,vertical) screen_size = (1000, 800) # Set up a tuple for the background color background_color = (82, 111, 53) # Set a caption on the terminal window pygame.display.set_caption("Python Shooter") # Create a pygame screen to use screen = pygame.display.set_mode(screen_size) # Instantiate a shooter object the_shooter = Shooter(screen) # Main game loop. Runs forever... (or until it sees a break) while 1: screen.fill(background_color) check_events() # Draw the shooter the_shooter.draw_me(screen) # Clear the screen for the next time through the loop. pygame.display.flip()
def scan_folder(folder): # print '**** processing:', folder logging.info('**** processing folder:{}'.format(folder)) movie_files = [ f for f in sorted(os.listdir(folder)) if f.endswith('.mp4') or f.endswith('.mkv') or f.endswith('.avi') ] for movie_file in movie_files: movie_file_full_path = os.path.join(folder, movie_file) # if subtitle already exist, ignore it srt_full_path = os.path.join(folder, movie_file + '.chn.srt') ass_full_path = os.path.join(folder, movie_file + '.chn.ass') sub_full_path = os.path.join(folder, movie_file + '.chn.sub') if os.path.exists(srt_full_path) or os.path.exists( ass_full_path) or os.path.exists(sub_full_path): # print '---- subtitle already get: {}'.format(movie_file) logging.info('---- EXIST subtitle for: {}'.format(movie_file)) continue # print '++++ subtitle for movie file: {}'.format(movie_file) shooter = Shooter(movie_file_full_path) count = shooter.start() logging.info('---- GET {} subtitle for {}'.format(count, movie_file)) # detail.append((movie_file_full_path, count)) if settings[SETTING_RECURSIVE]: sub_folders = [ f for f in sorted(os.listdir(folder)) if os.path.isdir(os.path.join(folder, f)) ] for sub_folder in sub_folders: ignore_hidden = settings[SETTING_IGNORE_HIDDEN] if ignore_hidden: if sub_folder.startswith("."): continue sub_folder_full_path = os.path.join(folder, sub_folder) scan_folder(sub_folder_full_path)
#!/usr/bin/env python ''' Created on Jan 20, 2014 @author: magic282 ''' import sys from Shooter import Shooter if __name__ == '__main__': print("Welcome to ShooterSubPyDownloader") fileNames = sys.argv[1:] for f in fileNames: shooter = Shooter(f) shooter.start()
def shootSub(file, nosub_list): shooter = Shooter(file) ok = shooter.start() if ok: subtitleClean(file, exclude_ext) else: nosub_list.append(os.path.basename(file))
def __init__(self, state: BotState): self.state = state self.turner = Turner(state) self.turretTurner = TurretTurner(state) self.mover = Mover(state, self.turner) self.shooter = Shooter(state, self.turretTurner)
if self.ACTIVE: self.screen.blit(self.image[self.cur_state], self.pos) if __name__ == "__main__": pygame.init() # Init pygame pygame.mixer.init() ## Configure screen = pygame.display.set_mode((800, 600)) # 800 x 600 pygame.display.set_caption(TITLE) # Title bg = pygame.Surface(screen.get_size()) # Background object bg = bg.convert() bg.fill((174, 170, 179)) game_map = GameMap(screen) s = Shooter(screen) clock = pygame.time.Clock() keep = True while keep: oldpos = pygame.math.Vector2(s.rect.x, s.rect.y) for e in pygame.event.get(): if e.type == pygame.QUIT: keep = False elif e.type == pygame.MOUSEBUTTONUP: print(pygame.mouse.get_pos()) # Debug purposes else: if e.type == pygame.KEYUP: if e.key == pygame.K_SPACE: if shooter.shoot(): shooter.snd_shoot.play(maxtime=1000) pygame.mixer.fadeout(500)
def CreateShooter(self): self.ShooterRail = 400 self.Shooter = Shooter(self.ShooterRail, 400) self.Items.Add(self.Shooter)