def getShot(self, shot_name): return Shot(self.directory, shot_name)
def tir(self, missilesShooter): self.compteurTir += 1 if self.compteurTir%30 == 0: missilesShooter.add(Shot.shotShooterEnnemy(self.rect.left,self.rect.top+20))
def updateShotList(self): self.shot_list = [] for shot_name in listdir(self.directory + "/05_shot/"): if re.match(r"s[0-9][0-9]p[0-9][0-9]", shot_name): shot = Shot(self.directory, shot_name) self.shot_list.append((shot.getShotNb(), shot.getShotName()))
def set(self, project): self.project = project if self.project.getShotList(): self.project_stats_path = self.project.getDirectory( ) + "/project_stats.spi" if not path.isfile(self.project_stats_path): open(self.project_stats_path, "a").close() with open(self.project_stats_path, "r") as f: str_stats = f.read() f.close() stats_label = Label(self, text="STATISTICS", bg=self.theme.main_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 11 bold") stats_label.pack(expand=True, fill=BOTH, pady=10) general_stats_area = Frame(self, bg=self.theme.second_color, bd=0) general_stats_area.pack(expand=True, fill=BOTH) ## HEADER ## separator1_area = Frame(self, bg=self.theme.separator_color, height=2, bd=0) separator1_area.pack(expand=True, fill=BOTH) self.stats_shots_header_area = Frame(self, bg=self.theme.main_color, bd=0) self.stats_shots_header_area.pack(expand=True, fill=BOTH) self.stats_shots_header_area.columnconfigure(0, weight=1) self.stats_shots_header_area.columnconfigure(1, weight=1) self.stats_shots_header_area.columnconfigure(2, weight=1) self.stats_shots_header_area.columnconfigure(3, weight=1) self.stats_shots_header_area.columnconfigure(4, weight=1) self.stats_shots_header_area.columnconfigure(5, weight=1) shot_header_label = Label(self.stats_shots_header_area, text="shot", bg=self.theme.main_color, fg=self.theme.text_color) shot_header_label.grid(row=0, column=0, pady=5, padx=10) shot_frame_range_header_label = Label(self.stats_shots_header_area, text="frame range", bg=self.theme.main_color, fg=self.theme.text_color) shot_frame_range_header_label.grid(row=0, column=1, pady=5, padx=10) shot_frame_range_header_label = Label(self.stats_shots_header_area, text="animation", bg=self.theme.main_color, fg=self.theme.text_color) shot_frame_range_header_label.grid(row=0, column=2, pady=5, padx=10) shot_frame_range_header_label = Label(self.stats_shots_header_area, text="lighting", bg=self.theme.main_color, fg=self.theme.text_color) shot_frame_range_header_label.grid(row=0, column=3, pady=5, padx=10) shot_frame_range_header_label = Label(self.stats_shots_header_area, text="rendering", bg=self.theme.main_color, fg=self.theme.text_color) shot_frame_range_header_label.grid(row=0, column=4, pady=5, padx=10) shot_frame_range_header_label = Label(self.stats_shots_header_area, text="compositing", bg=self.theme.main_color, fg=self.theme.text_color) shot_frame_range_header_label.grid(row=0, column=5, pady=5, padx=10) separator2_area = Frame(self, bg=self.theme.separator_color, height=2, bd=0) separator2_area.pack(expand=True, fill=BOTH) stats_shots_area = Frame(self, bg=self.theme.main_color, bd=0) stats_shots_area.pack(expand=True, fill=BOTH) ## SHOTS STATS ## i = 0 done_shots = 0 animations_states = {"To do": 0, "WIP": 0, "Done": 0} lightings_states = {"To do": 0, "WIP": 0, "Done": 0} renderings_states = {"To do": 0, "WIP": 0, "Done": 0} compositings_states = {"To do": 0, "WIP": 0, "Done": 0} self.shot_label_list = [] self.shot_text_list = [] self.shot_frame_range_label_list = [] self.shot_frame_range_text_list = [] self.animation_menu_list = {} self.lighting_menu_list = {} self.rendering_menu_list = {} self.compositing_menu_list = {} self.vars_shot_animation = {} self.vars_shot_lighting = {} self.vars_shot_rendering = {} self.vars_shot_compositing = {} self.stats_dict = {} for shot in self.project.getShotList(): cur_shot = Shot(self.project.getDirectory(), shot[1]) if i % 2 == 0: shot_line = Frame(self, bg=self.theme.stat_list_color1, bd=0) shot_line.pack(expand=True, fill=BOTH) else: shot_line = Frame(self, bg=self.theme.stat_list_color2, bd=0) shot_line.pack(expand=True, fill=BOTH) shot_line.columnconfigure(0, weight=1) shot_line.columnconfigure(1, weight=1) shot_line.columnconfigure(2, weight=1) shot_line.columnconfigure(3, weight=1) shot_line.columnconfigure(4, weight=1) shot_line.columnconfigure(5, weight=1) shot_text = StringVar() self.shot_text_list.append(shot_text) self.shot_text_list[i].set(shot[1]) shot_label = Label(shot_line, textvariable=self.shot_text_list[i], bg=shot_line.cget("bg"), fg=self.theme.text_color) shot_label.grid(row=shot[0], column=0, pady=5, padx=10) self.shot_label_list.append(shot_label) shot_frame_range_text = StringVar() self.shot_frame_range_text_list.append(shot_frame_range_text) self.shot_frame_range_text_list[i].set( cur_shot.getFrameRange()) shot_frame_range_label = Label( shot_line, textvariable=self.shot_frame_range_text_list[i], bg=shot_line.cget("bg"), fg=self.theme.text_color) shot_frame_range_label.grid(row=shot[0], column=1, pady=5, padx=10) self.shot_frame_range_label_list.append(shot_frame_range_label) self.vars_shot_animation[shot[1]] = StringVar() self.vars_shot_lighting[shot[1]] = StringVar() self.vars_shot_rendering[shot[1]] = StringVar() self.vars_shot_compositing[shot[1]] = StringVar() if str_stats: self.stats_dict = json.loads(str_stats) if self.stats_dict[shot[1]]: self.vars_shot_animation[shot[1]].set( self.stats_dict[shot[1]][0]) if self.stats_dict[shot[1]][0]: animations_states[self.stats_dict[shot[1]][0]] += 1 self.vars_shot_lighting[shot[1]].set( self.stats_dict[shot[1]][1]) if self.stats_dict[shot[1]][1]: lightings_states[self.stats_dict[shot[1]][1]] += 1 self.vars_shot_rendering[shot[1]].set( self.stats_dict[shot[1]][2]) if self.stats_dict[shot[1]][2]: renderings_states[self.stats_dict[shot[1]][2]] += 1 self.vars_shot_compositing[shot[1]].set( self.stats_dict[shot[1]][3]) if self.stats_dict[shot[1]][3]: compositings_states[self.stats_dict[shot[1]] [3]] += 1 else: self.vars_shot_animation[shot[1]].set("To do") self.vars_shot_lighting[shot[1]].set("To do") self.vars_shot_rendering[shot[1]].set("To do") self.vars_shot_compositing[shot[1]].set("To do") else: self.vars_shot_animation[shot[1]].set("To do") self.vars_shot_lighting[shot[1]].set("To do") self.vars_shot_rendering[shot[1]].set("To do") self.vars_shot_compositing[shot[1]].set("To do") animation_menu = OptionMenu(shot_line, self.vars_shot_animation[shot[1]], "To do", "WIP", "Done", command=self.statisticsMenuCommand) animation_menu.config( bg=self.theme.button_color2, activebackground=self.theme.over_button_color2, activeforeground=self.theme.text_color, bd=0, width=8, highlightthickness=0) animation_menu.grid(row=shot[0], column=2, pady=5, padx=10) self.animation_menu_list[shot[1]] = animation_menu lighting_menu = OptionMenu(shot_line, self.vars_shot_lighting[shot[1]], "To do", "WIP", "Done", command=self.statisticsMenuCommand) lighting_menu.config( bg=self.theme.button_color2, activebackground=self.theme.over_button_color2, activeforeground=self.theme.text_color, bd=0, width=8, highlightthickness=0) lighting_menu.grid(row=shot[0], column=3, pady=5, padx=10) self.lighting_menu_list[shot[1]] = lighting_menu rendering_menu = OptionMenu(shot_line, self.vars_shot_rendering[shot[1]], "To do", "WIP", "Done", command=self.statisticsMenuCommand) rendering_menu.config( bg=self.theme.button_color2, activebackground=self.theme.over_button_color2, activeforeground=self.theme.text_color, bd=0, width=8, highlightthickness=0) rendering_menu.grid(row=shot[0], column=4, pady=5, padx=10) self.rendering_menu_list[shot[1]] = rendering_menu compositing_menu = OptionMenu( shot_line, self.vars_shot_compositing[shot[1]], "To do", "WIP", "Done", command=self.statisticsMenuCommand) compositing_menu.config( bg=self.theme.button_color2, activebackground=self.theme.over_button_color2, activeforeground=self.theme.text_color, bd=0, width=8, highlightthickness=0) compositing_menu.grid(row=shot[0], column=5, pady=5, padx=10) self.compositing_menu_list[shot[1]] = compositing_menu if cur_shot.isDone(): done_shots += 1 i += 1 ## GENERAL STATS ## number_of_shots_label = Label( general_stats_area, text=str(len(self.project.getShotList())) + " SHOTS", bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") number_of_shots_label.grid(row=0, column=0, pady=5, padx=10) self.done_shots_text = StringVar() self.done_shots_text.set( str(done_shots) + " done shot (" + str(round(done_shots / len(self.project.getShotList()) * 100)) + "%)") number_of_done_shots_label = Label( general_stats_area, textvariable=self.done_shots_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") number_of_done_shots_label.grid(row=1, column=0, pady=5, padx=10) general_to_do_label = Label(general_stats_area, text="TO DO", bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") general_to_do_label.grid(row=2, column=1, pady=5, padx=10) general_wip_label = Label(general_stats_area, text="WIP", bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") general_wip_label.grid(row=2, column=2, pady=5, padx=10) general_done_label = Label(general_stats_area, text="DONE", bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") general_done_label.grid(row=2, column=3, pady=5, padx=10) #ANIMATION# general_animation_label = Label(general_stats_area, text="ANIMATION", bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") general_animation_label.grid(row=3, column=0, pady=5, padx=10) self.animation_to_do_text = StringVar() self.animation_to_do_text.set( str( round(animations_states["To do"] / len(self.project.getShotList()) * 100)) + "%") animation_to_do_label = Label( general_stats_area, textvariable=self.animation_to_do_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") animation_to_do_label.grid(row=3, column=1, pady=5, padx=10) self.animation_wip_text = StringVar() self.animation_wip_text.set( str( round(animations_states["WIP"] / len(self.project.getShotList()) * 100)) + "%") animation_wip_label = Label(general_stats_area, textvariable=self.animation_wip_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") animation_wip_label.grid(row=3, column=2, pady=5, padx=10) self.animation_done_text = StringVar() self.animation_done_text.set( str( round(animations_states["Done"] / len(self.project.getShotList()) * 100)) + "%") animation_done_label = Label(general_stats_area, textvariable=self.animation_done_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") animation_done_label.grid(row=3, column=3, pady=5, padx=10) #LIGHTING# general_lighting_label = Label(general_stats_area, text="LIGHTING", bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") general_lighting_label.grid(row=4, column=0, pady=5, padx=10) self.lighting_to_do_text = StringVar() self.lighting_to_do_text.set( str( round(lightings_states["To do"] / len(self.project.getShotList()) * 100)) + "%") lighting_to_do_label = Label(general_stats_area, textvariable=self.lighting_to_do_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") lighting_to_do_label.grid(row=4, column=1, pady=5, padx=10) self.lighting_wip_text = StringVar() self.lighting_wip_text.set( str( round(lightings_states["WIP"] / len(self.project.getShotList()) * 100)) + "%") lighting_wip_label = Label(general_stats_area, textvariable=self.lighting_wip_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") lighting_wip_label.grid(row=4, column=2, pady=5, padx=10) self.lighting_done_text = StringVar() self.lighting_done_text.set( str( round(lightings_states["Done"] / len(self.project.getShotList()) * 100)) + "%") lighting_done_label = Label(general_stats_area, textvariable=self.lighting_done_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") lighting_done_label.grid(row=4, column=3, pady=5, padx=10) #RENDERING# general_rendering_label = Label(general_stats_area, text="RENDERING", bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") general_rendering_label.grid(row=5, column=0, pady=5, padx=10) self.rendering_to_do_text = StringVar() self.rendering_to_do_text.set( str( round(renderings_states["To do"] / len(self.project.getShotList()) * 100)) + "%") rendering_to_do_label = Label( general_stats_area, textvariable=self.rendering_to_do_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") rendering_to_do_label.grid(row=5, column=1, pady=5, padx=10) self.rendering_wip_text = StringVar() self.rendering_wip_text.set( str( round(renderings_states["WIP"] / len(self.project.getShotList()) * 100)) + "%") rendering_wip_label = Label(general_stats_area, textvariable=self.rendering_wip_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") rendering_wip_label.grid(row=5, column=2, pady=5, padx=10) self.rendering_done_text = StringVar() self.rendering_done_text.set( str( round(renderings_states["Done"] / len(self.project.getShotList()) * 100)) + "%") rendering_done_label = Label(general_stats_area, textvariable=self.rendering_done_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") rendering_done_label.grid(row=5, column=3, pady=5, padx=10) #COMPOSITING# general_compositing_label = Label(general_stats_area, text="COMPOSITING", bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") general_compositing_label.grid(row=6, column=0, pady=5, padx=10) self.compositing_to_do_text = StringVar() self.compositing_to_do_text.set( str( round(compositings_states["To do"] / len(self.project.getShotList()) * 100)) + "%") compositing_to_do_label = Label( general_stats_area, textvariable=self.compositing_to_do_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") compositing_to_do_label.grid(row=6, column=1, pady=5, padx=10) self.compositing_wip_text = StringVar() self.compositing_wip_text.set( str( round(compositings_states["WIP"] / len(self.project.getShotList()) * 100)) + "%") compositing_wip_label = Label( general_stats_area, textvariable=self.compositing_wip_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") compositing_wip_label.grid(row=6, column=2, pady=5, padx=10) self.compositing_done_text = StringVar() self.compositing_done_text.set( str( round(compositings_states["Done"] / len(self.project.getShotList()) * 100)) + "%") compositing_done_label = Label( general_stats_area, textvariable=self.compositing_done_text, bg=self.theme.second_color, fg=self.theme.text_color, height=1, justify=CENTER, font="Helvetica 9 bold") compositing_done_label.grid(row=6, column=3, pady=5, padx=10)
def tir(self, missiles): self.inCharge = False # Basic Weapon Lvl 1 if self.versionCanon == 1: nbShoot = (self.charge / self.chaleurMissile) + 1 for m in range(nbShoot): if self.chaleur + self.chaleurMissile < (self.chaleurMax): monMissile = Shot.shotShip( self.versionCanon, self.rect.left + 40, self.rect.top - (nbShoot * 30) + (60 * m) + 40, self.isBonusAmmo, ) missiles.add(monMissile) sound = pygame.mixer.Sound("sounds/rocket.wav") if self.player.soundOn: sound.play() if self.chaleur + self.chaleurMissile < self.chaleurMax: self.chaleur += self.chaleurMissile else: self.chaleur = self.chaleurMax if self.isBonusAmmo: self.chaleur -= self.chaleurMissile # Basic Weapon Lvl 2 if self.versionCanon == 2: nbShoot = (self.charge / self.chaleurMissile) + 1 for m in range(nbShoot * 2): if self.chaleur + self.chaleurMissile / 2 < (self.chaleurMax): if m == 1: monMissile = Shot.shotShip( self.versionCanon, self.rect.left + 40, self.rect.top - (nbShoot * 25) + (60 * m) + 40, self.isBonusAmmo, ) missiles.add(monMissile) sound = pygame.mixer.Sound("sounds/rocket.wav") sound.play() if self.chaleur + self.chaleurMissile / 2 < self.chaleurMax: self.chaleur += self.chaleurMissile / 2 else: self.chaleur = self.chaleurMax if self.isBonusAmmo: self.chaleur -= self.chaleurMissile / 2 else: if m < nbShoot: monMissile = Shot.shotShip( self.versionCanon, self.rect.left + 40, self.rect.top - (nbShoot * 25) + (60 * m) + 40, self.isBonusAmmo, ) missiles.add(monMissile) sound = pygame.mixer.Sound("sounds/rocket.wav") sound.play() if self.chaleur + self.chaleurMissile / 2 < self.chaleurMax: self.chaleur += self.chaleurMissile / 2 else: self.chaleur = self.chaleurMax if self.isBonusAmmo: self.chaleur -= self.chaleurMissile / 2 else: monMissile = Shot.shotShip( self.versionCanon, self.rect.left + 70, self.rect.top - (nbShoot * 25) + 60 * (m - nbShoot) + 40, self.isBonusAmmo, ) missiles.add(monMissile) sound = pygame.mixer.Sound("sounds/rocket.wav") sound.play() if self.chaleur + self.chaleurMissile / 2 < self.chaleurMax: self.chaleur += self.chaleurMissile / 2 else: self.chaleur = self.chaleurMax if self.isBonusAmmo: self.chaleur -= self.chaleurMissile / 2 # Extrem Weapon Lvl 1 if self.versionCanon == 3: nbShoot = (self.charge / self.chaleurMissile) + 1 for m in range(nbShoot): if self.chaleur + self.chaleurMissile < (self.chaleurMax): monMissile = Shot.shotShip( self.versionCanon, self.rect.left + 40, self.rect.top - (nbShoot * 30) + (60 * m) + 40, self.isBonusAmmo, ) missiles.add(monMissile) sound = pygame.mixer.Sound("sounds/laser.wav") sound.play() if self.chaleur + self.chaleurMissile < self.chaleurMax: self.chaleur += self.chaleurMissile else: self.chaleur = self.chaleurMax if self.isBonusAmmo: self.chaleur -= self.chaleurMissile # Extrem Weapon Lvl 2 if self.versionCanon == 4: nbShoot = (self.charge / self.chaleurMissile) + 1 for m in range(nbShoot * 2): if self.chaleur + self.chaleurMissile / 2 < (self.chaleurMax): if m == 1: monMissile = Shot.shotShip( self.versionCanon, self.rect.left + 40, self.rect.top - (nbShoot * 25) + (60 * m) + 40, self.isBonusAmmo, ) missiles.add(monMissile) sound = pygame.mixer.Sound("sounds/laser.wav") sound.play() if self.chaleur + self.chaleurMissile / 2 < self.chaleurMax: self.chaleur += self.chaleurMissile / 2 else: self.chaleur = self.chaleurMax if self.isBonusAmmo: self.chaleur -= self.chaleurMissile / 2 else: if m < nbShoot: monMissile = Shot.shotShip( self.versionCanon, self.rect.left + 40, self.rect.top - (nbShoot * 25) + (60 * m) + 40, self.isBonusAmmo, ) missiles.add(monMissile) sound = pygame.mixer.Sound("sounds/laser.wav") sound.play() if self.chaleur + self.chaleurMissile / 2 < self.chaleurMax: self.chaleur += self.chaleurMissile / 2 else: self.chaleur = self.chaleurMax if self.isBonusAmmo: self.chaleur -= self.chaleurMissile / 2 else: monMissile = Shot.shotShip( self.versionCanon, self.rect.left + 70, self.rect.top - (nbShoot * 25) + 60 * (m - nbShoot) + 40, self.isBonusAmmo, ) missiles.add(monMissile) sound = pygame.mixer.Sound("sounds/laser.wav") sound.play() if self.chaleur + self.chaleurMissile / 2 < self.chaleurMax: self.chaleur += self.chaleurMissile / 2 else: self.chaleur = self.chaleurMax if self.isBonusAmmo: self.chaleur -= self.chaleurMissile / 2 self.charge = 0
def construct(self, json_file): total = len(json_file) for i in range(total): # Source collecting shot_id = json_file[i]['id'] user_id = json_file[i]['user']['id'] shot_image_url = json_file[i]['images']['normal'] # if shot_image_url is None: # shot_image_url = json_file[i]['images']['normal'] avatar_url = json_file[i]['user']['avatar_url'] shot_description = json_file[i]['description'] user_name = json_file[i]['user']['name'] view = json_file[i]['views_count'] like = json_file[i]['likes_count'] comment = json_file[i]['comments_count'] tags = json_file[i]['tags'] # animated flag flag = json_file[i]['animated'] # Record Building new_shot = Shot(shot_id) new_shot.load_description(shot_description) new_shot.load_image_url(shot_image_url) new_shot.load_popularity(view, like, comment) new_shot.load_tags(tags) new_author = Author(user_id) new_author.load_avatar_url(avatar_url) new_author.load_name(user_name) new_shot.add_author(new_author) if flag is False: self.shots[shot_id] = new_shot self.logger.info("Shot id: {} is decoded.".format(shot_id)) else: self.logger.info("Shot id: {} is omitted.".format(shot_id))
def on_execute(self): if self.on_init() == False: self._running = False while self._running: # # event handling loop # for event in pygame.event.get(): if event.type == pygame.locals.QUIT: pygame.quit() sys.exit() #handling keyboard input #start moving if event.type == pygame.locals.KEYDOWN: if event.key == pygame.locals.K_w: self.pressed_up = True if event.key == pygame.locals.K_d: self.pressed_right = True if event.key == pygame.locals.K_s: self.pressed_down = True if event.key == pygame.locals.K_a: self.pressed_left = True #stop moving elif event.type == pygame.locals.KEYUP: if event.key == pygame.locals.K_w: self.pressed_up = False if event.key == pygame.locals.K_d: self.pressed_right = False if event.key == pygame.locals.K_s: self.pressed_down = False if event.key == pygame.locals.K_a: self.pressed_left = False #handling mouse input #looking around / aiming elif event.type == pygame.MOUSEMOTION: mousePos = event.pos #firing elif event.type == pygame.MOUSEBUTTONDOWN and event.button == 1: self.pressed_lmouse = True mousePos = event.pos shot = Shot.Shot(mousePos, self.player.getPosition()) self.shotList.append(shot) self.lineColor = (0, 0, 255) elif event.type == pygame.MOUSEBUTTONUP and event.button == 1: self.pressed_lmouse = False mousePos = event.pos self.lineColor = (255, 0, 0) #spawning zombies if event.type == self.ZOMBIESPAWN: newZombie = zombie.Zombie() self.zombieList.append(newZombie) newZombie.spawn(self.player.getPosition(), self.displaysurf) print("Zombie spawned") # # moving the player # if self.pressed_up: if self.player.getPosition().top > 0: self.player.move(0, -self.player.pace) if self.pressed_right: if self.player.getPosition( ).right < self.WINDOWWIDTH - self.player.pace: self.player.move(self.player.pace, 0) if self.pressed_down: if self.player.getPosition( ).bottom < self.WINDOWHEIGHT - self.player.pace: self.player.move(0, self.player.pace) if self.pressed_left: if self.player.getPosition().left > 0: self.player.move(-self.player.pace, 0) # # render # self.displaysurf.fill((255, 255, 255)) pygame.draw.line(self.displaysurf, self.lineColor, (self.player.getPosition().left + self.player.appearance.get_width() / 2, self.player.getPosition().top + self.player.appearance.get_height() / 2), mousePos) # # checking shot collision # for shot in self.shotList: #checking if the shot is out of the screen if shot.isOutOfScreen(self.WINDOWWIDTH, self.WINDOWHEIGHT): self.shotList.remove(shot) print("deleting shot") else: shot.move(self.displaysurf) # good style? (regarding the different data types in a single return statement) #checking if the shot is hitting a zombie collisionArray = shot.collisionCheck(self.zombieList) if collisionArray[0] == True: self.shotList.remove(shot) self.zombieList = collisionArray[1] print("deleting shot") # # zombie spawner # for zomb in self.zombieList: zomb.move(self.displaysurf) self.player.draw(self.displaysurf) self.fpsClock.tick(self.FPS) pygame.display.update()