Exemple #1
0
 def updateProjectiles(self, dtime, enemy_list):
     '''Updates all the projectiles the tower has shot'''
     # Controlling projectiles
     count = 0
     for i in self.projectileList:
         i.update(dtime)
         for ii in enemy_list:
             if twoD_math.point_distance_check(i.pos[0], i.pos[1], ii.pos[0], ii.pos[1]) < i.radius**2+ii.radius**2:
                 ii.health -= i.damage
                 self.projectileList = util.listPop(self.projectileList, count)
         if i.time >= 2:
             self.projectileList = util.listPop(self.projectileList, count)
         count += 1
Exemple #2
0
 def updateEnemies(self, dtime):
     '''Updates enemies duh'''
     global currentgold, lives
     count = 0
     for i in self.enemy_list:
         i.update(dtime)
         if i.pos[0] > windowW+64 or i.pos[0] < 0-64 or i.pos[1] > windowH+64 or i.pos[1] < 0-64:
             self.enemy_list = util.listPop(self.enemy_list, count)
             lives -= 1
         if i.health <= 0:
             self.enemy_list = util.listPop(self.enemy_list, count)
             currentgold += i.worth
         count += 1
         self.checkDtileCollision(i)
Exemple #3
0
 def spawnEnemies(self, dtime):
     '''Spawns enemies'''
     if self.spawn_rate >= self.spawn_rateMax and len(self.spawnList) > 0:
         randSpawn = randint(0, len(self.SpawnLocation)-1)
         enemy = Enemy("Enemy: " + str(self.spawn_count), self.spawnList[0][0],self.spawnList[0][3], self.spawnList[0][4], self.SpawnLocation[randSpawn][1], [self.SpawnLocation[randSpawn][0][0], self.SpawnLocation[randSpawn][0][1]], self.spawnList[0][5], self.spawnList[0][6], self.spawnList[0][7])
         self.enemy_list.append(enemy)
         self.spawnList = util.listPop(self.spawnList, 0);
         self.spawn_rate = 0;
         self.spawn_rateMax = self.Round*-1/50 + 0.5 #Lol y = mx + b :P
         self.spawn_count += 1*dtime;