예제 #1
0
 def _create_unarmed(cls):
     if cls.unarmed_img is None:
         r = np.uint16(SHIP_RADIUS * PIXELS_PER_UNIT)
         cls.unarmed_img = deepcopy(cls.back())
         circle(cls.unarmed_img, SHIP_CENTER, max(1, r), 1.0, -1)
         cls.unarmed_img = blur(cls.unarmed_img, r + 6)
         Images.save_ship(cls.unarmed_img, 'u')
         logging.debug('made unarmed')
     return cls.unarmed_img
예제 #2
0
 def armed(cls, x=0, y=0):
     if cls.armed_img is None:
         r = np.uint16(WEAPON_RADIUS * PIXELS_PER_UNIT * .8)
         cls.armed_img = deepcopy(cls.back())
         circle(cls.armed_img, SHIP_CENTER, r, 1.0, -1)
         cls.armed_img = blur(cls.armed_img, r * 1.1)
         Images.save_ship(cls.armed_img, 'a')
         logging.debug('made armed')
     return Images.Layer.from_np(cls.armed_img, x, y)
예제 #3
0
 def full(cls, r, x=0, y=0):
     rr = cls.get_shapes(r)
     if rr not in cls.full_img.keys():
         logging.debug('made full[{}]'.format(rr))
         img = deepcopy(cls.back(rr))
         R = np.uint16(r * PIXELS_PER_UNIT)
         circle(img, cls.center[rr], R, 1.0, -1)
         cls.full_img.update({rr: blur(img, r * 1.3 + 6)})
         Images.save_planet(cls.full_img[rr], 'f', rr)
     return Images.Layer.from_np(cls.full_img[rr], x, y)
예제 #4
0
 def friendly(cls, x=0, y=0):
     if cls.friendly_img is None:
         r = SHIP_RADIUS * PIXELS_PER_UNIT
         img = deepcopy(cls._create_unarmed())
         circle(img, SHIP_CENTER, np.uint16(r * 3.0), 1.0, -1)
         img = blur(img, r + 5)
         cls.friendly_img = circle(img, SHIP_CENTER, np.uint16(r * 2.5),
                                   0.0, -1)
         Images.save_ship(cls.friendly_img, 'f')
         logging.debug('made friendly')
     return Images.Layer.from_np(cls.friendly_img, x, y)
예제 #5
0
 def dockable(cls, r, x=0, y=0):
     rr = cls.get_shapes(r)
     if rr not in cls.dock_img.keys():
         logging.debug('made dockable[{}]'.format(rr))
         img = deepcopy(cls.back(rr))
         R = np.uint16((r + DOCK_RADIUS) * PIXELS_PER_UNIT)
         circle(img, cls.center[rr], R, 1.0, -1)
         img = blur(img, r * 1.2 + 6)
         circle(
             img, cls.center[rr],
             np.uint16(max(r - DOCK_RADIUS / 2, 2) * PIXELS_PER_UNIT),
             0.0, -1)
         cls.dock_img.update({rr: img})
         Images.save_planet(cls.dock_img[rr], 'd', rr)
     return Images.Layer.from_np(cls.dock_img[rr], x, y)