My game variables
#Game rules
time = 1
time_passed = 0
complete_time = 400
enemy_timer = random.choice([1000,2000,3000])
finished_enemy = pygame.time.get_ticks()
enemies_alive = 0
My creation of enemies
#creating enemies
if time_passed < complete_time :
if pygame.time.get_ticks() - finished_enemy > enemy_timer:
r = random.randint(0, len(enemy_types) - 1)
enemy = Enemy(enemy_health[r],enemy_animations[r], WINDOW_WIDTH - -10, WINDOW_HEIGHT - 260, 2) #gets arguments from enemy class and where they are(location)
enemy_1 = Enemy(enemy_health[r],enemy_animations[r], WINDOW_WIDTH - -10, WINDOW_HEIGHT - 160, 1)
enemy_2 = Enemy(enemy_health[r],enemy_animations[r], WINDOW_WIDTH - -10, WINDOW_HEIGHT - 60, 3)
enemy_group.add(enemy,enemy_1,enemy_2)
finished_enemy = pygame.time.get_ticks()
#allows for increasing difficulty
time_passed += enemy_health[r]
print(time_passed)
Sorry for wording of the question as i dont know how to describe what i want in a sentence.
Anyway I have the code for randomizing three values for enemy_timer (1000,2000,3000) what it does is separate the images of my enemy by millisecond. I want it to affect enemy, enemy_1 and enemy_2 differently. Such as when i run enemy has 1000 enemy_2 has 3000 so on.
Aucun commentaire:
Enregistrer un commentaire