Browse Source

Base Levels class

master
Elis Axelsson 3 years ago
parent
commit
7643d8097f
1 changed files with 34 additions and 0 deletions
  1. +34
    -0
      classes/levels.py

+ 34
- 0
classes/levels.py View File

@ -0,0 +1,34 @@
import pygame
from classes.settings import Settings
from classes.enemies.ogre import Ogre
class Levels(object):
lastEnemy = 0
currentLevel = 0
levels = [
{
'delay': 2000,
'count': 10,
'waves': [
Ogre,
],
},
]
def __init__(self):
self.enemyStart = Settings().enemyStart
def get_enemy(self):
# Get current game time
currentEnemyTime = pygame.time.get_ticks()
# Check if it's time to spawn an enemy
if (((currentEnemyTime - self.lastEnemy) <
self.levels[self.currentLevel]['delay'])):
return None
# Update last enemy spawn time
self.lastEnemy = currentEnemyTime
return Ogre(self.enemyStart)

Loading…
Cancel
Save