def shoot_zombies(): update_input() Calculus.show_question() if Var.mouseDOWN and Var.Ammo != 0: Ammo = Sprite.Ammo(Chicken, 2, (Sprite.Player.posx, Sprite.Player.posy), False) Sprite.Bullets.add(Ammo) for zombie in Sprite.Zombies: zombie.moveto(1, 1, [(Sprite.Player.posx, Sprite.Player.posy)], False) for zombie in range(Var.screenZombies - (len(Sprite.Zombies))): zomx = random.randint(0, Sprite.DISPLAY_X) zomy = random.randint(0, Sprite.DISPLAY_Y) zombie = Sprite.Zombie(Images.Zombie_Image, 2, (zomx, zomy), False) Sprite.Zombies.add(zombie) Sprite.spritesList.add(zombie)
def shoot_zombies(): if Var.set_up_class == True: global time_elapsed, wait_time, total_time_elapsed for zombie in Sprite.Zombies: zombie.kill() Var.Answer = None Var.Health = 30 Var.Ammo = 8 Var.screenZombies = 1 Var.totalKilled = 0 Var.addZombie = 1 Var.totalSolved = 0 time_elapsed = 0 wait_time = 250 total_time_elapsed = 0 Sprite.objList.add(classroomwall) Sprite.spritesList.add(classroomwall) Var.set_up_class = False Sprite.DISPLAY.blit(classroom, (0, 0)) Sprite.objList.update() Sprite.Bullets.update() Sprite.Player.update() Sprite.Zombies.update() Sprite.drawSprites(Sprite.spritesList) update_input() Calculus.show_question() if Var.mouseDOWN and Var.Ammo != 0: Ammo = Sprite.Ammo(Chicken, 2, (Sprite.Player.posx, Sprite.Player.posy), False) Sprite.Bullets.add(Ammo) for zombie in Sprite.Zombies: zombie.moveto(1, 1, [(Sprite.Player.posx, Sprite.Player.posy)], False) '''# modulos so that zombies come in "waves". OR escalating difficulty with ugly conditionals # addZombies = Var.totalKilled%5 # screenZombies = Var.screenZombies + addZombies''' '''for zombie in range(Var.screenZombies - (len(Sprite.Zombies))): #zomx = random.randint(0, Sprite.DISPLAY_X) zomx = random.choice([0, Sprite.DISPLAY_X]) zomy = random.randint(0, Sprite.DISPLAY_Y) zombie = Sprite.Zombie(Images.Zombie_Image, 2, (zomx, zomy), False) Sprite.Zombies.add(zombie) Sprite.spritesList.add(zombie) # change this for time based instead if Var.totalKilled == 3: Var.screenZombies = 2 elif Var.totalKilled == 5: Var.screenZombies = 3 elif Var.totalKilled == 10: Var.screenZombies = 4 elif Var.totalKilled == 15: Var.screenZombies = 5 ''' # revamped for time based: Var.addZombie = 1 if add a zombie; Var.addZombie = 0 if NOT add time_elapsed += 1 total_time_elapsed += 1 if time_elapsed > wait_time: Var.addZombie = 1 time_elapsed = 0 if total_time_elapsed >= 1500: wait_time = 155 elif total_time_elapsed >= 1300: wait_time = 160 elif total_time_elapsed >= 1100: wait_time = 180 elif total_time_elapsed >= 800: wait_time = 200 elif total_time_elapsed >= 500: wait_time = 225 '''if Var.totalKilled == 4: wait_time = 225 elif Var.totalKilled == 8: wait_time = 200 elif Var.totalKilled == 12: wait_time = 180 elif Var.totalKilled == 15: wait_time = 160''' for zombie in range(Var.addZombie): #zomx = random.randint(0, Sprite.DISPLAY_X) zomx = random.choice([0, Sprite.DISPLAY_X]) zomy = random.randint(0, Sprite.DISPLAY_Y) zombie = Sprite.Zombie(Images.Zombie_Image, 2, (zomx, zomy), False) Sprite.Zombies.add(zombie) Sprite.spritesList.add(zombie) Var.addZombie = 0 if Var.Health == 0: # Game over Var.in_class = False Var.you_died = True Var.set_up_died = True
def shoot_zombies(): global time_elapsed, wait_time #Sprite.DISPLAY.fill((100,120,80)) Sprite.DISPLAY.blit(classroom, (0, 0)) Sprite.objList.update() Sprite.Bullets.update() Sprite.Player.update() Sprite.Zombies.update() Sprite.drawSprites(Sprite.spritesList) update_input() Calculus.show_question() if Var.mouseDOWN and Var.Ammo != 0: Ammo = Sprite.Ammo(Chicken, 2, (Sprite.Player.posx, Sprite.Player.posy), False) Sprite.Bullets.add(Ammo) for zombie in Sprite.Zombies: zombie.moveto(1, 1, [(Sprite.Player.posx, Sprite.Player.posy)], False) '''# modulos so that zombies come in "waves". OR escalating difficulty with ugly conditionals # addZombies = Var.totalKilled%5 # screenZombies = Var.screenZombies + addZombies''' '''for zombie in range(Var.screenZombies - (len(Sprite.Zombies))): #zomx = random.randint(0, Sprite.DISPLAY_X) zomx = random.choice([0, Sprite.DISPLAY_X]) zomy = random.randint(0, Sprite.DISPLAY_Y) zombie = Sprite.Zombie(Images.Zombie_Image, 2, (zomx, zomy), False) Sprite.Zombies.add(zombie) Sprite.spritesList.add(zombie) # change this for time based instead if Var.totalKilled == 3: Var.screenZombies = 2 elif Var.totalKilled == 5: Var.screenZombies = 3 elif Var.totalKilled == 10: Var.screenZombies = 4 elif Var.totalKilled == 15: Var.screenZombies = 5 ''' # revamped for time based: Var.addZombie = 1 if add a zombie; Var.addZombie = 0 if NOT add time_elapsed += 1 if time_elapsed > wait_time: Var.addZombie = 1 time_elapsed = 0 if Var.totalKilled == 4: wait_time = 225 elif Var.totalKilled == 8: wait_time = 200 elif Var.totalKilled == 12: wait_time = 180 elif Var.totalKilled == 15: wait_time = 160 print(Var.totalKilled) for zombie in range(Var.addZombie): #zomx = random.randint(0, Sprite.DISPLAY_X) zomx = random.choice([0, Sprite.DISPLAY_X]) zomy = random.randint(0, Sprite.DISPLAY_Y) zombie = Sprite.Zombie(Images.Zombie_Image, 2, (zomx, zomy), False) Sprite.Zombies.add(zombie) Sprite.spritesList.add(zombie) Var.addZombie = 0 if Var.Health == 0: # Game over print("You died")