Esempio n. 1
0
 def spawn_at_random(self, obj):
     success = False
     
     while not success:
         x = rnd.get_int(0, self.WIDTH - 1)
         y = rnd.get_int(0, self.HEIGHT - 1) 
         success = self.spawn_at(obj, geometry.get_point(x, y))
     
     return success
Esempio n. 2
0
 def _create_spawn_points(self, raw_map):
     _xy_list = list()
     
     for _n in xrange(self._number_of_spawn_points):
         xy = None
         while not xy:
             x = rnd.get_int(1, self.WIDTH) - 1
             y = rnd.get_int(1, self.WIDTH) - 1
             if not raw_map[x][y].blocks:
                 raw_map[x][y].update_col(color.get_color(color.PURPLE, 2))
                 xy = geometry.get_point(x, y)
         _xy_list.append(xy)
     
     return tuple(_xy_list)
Esempio n. 3
0
 def spawn_on_spawn_point(self, obj, xy=None):
     if xy:
         return self.spawn_at(obj, xy)
     else:
         # Choose at random
         i = rnd.get_int(1, len(self.spawn_points))
         i-=1
         obj.xy = self.spawn_points[i]
         return True