Beispiel #1
0
 def __init__(self, pos, sheet, frame_width):
     SpriteBase.__init__(self, pos)
     self._sheet = pygame.image.load(resource_path(sheet)).convert_alpha()
     self._frame_width = frame_width
     self._frame = 0
     self._angle = 0
     self._update_image()
Beispiel #2
0
 def __init__(self,
              pos,
              text,
              size,
              onclick,
              image_path=None,
              label=None,
              icon=None,
              color=PICO_BLUE,
              asset_border=False,
              fixed_width=None):
     SpriteBase.__init__(self, pos)
     self.color = color
     self.text = text
     self.size = size
     self.fixed_width = fixed_width
     self.onclick_callback = onclick
     self.selectable = True
     self.image_path = image_path
     self.label = label
     self.icon = icon
     self.joy_button = None
     self.radius = 15
     self.asset_border = asset_border
     self.disabled = False
     self._generate_image()
Beispiel #3
0
 def __init__(self, pos, text, size, onclick):
     SpriteBase.__init__(self, pos)
     self.color = PICO_WHITE
     self.text = text
     self.size = size
     self.onclick = onclick
     self.selectable = True
     self._generate_image()
Beispiel #4
0
 def __init__(self, pos, meter_width, min, max):
     SpriteBase.__init__(self, pos)
     self.meter_width = meter_width
     self.min = min
     self.max = max
     self.value = self.min
     self.selectable = True
     self._generate_image()
Beispiel #5
0
 def __init__(self, pos, gridsize=20, size=None):
     SpriteBase.__init__(self, pos)
     self.gridsize = gridsize
     self.time = 0
     self.stars = []
     self.size = size or game.RES
     for i in range(90):
         self.stars.append(
             (random.randint(0,
                             game.RES[0]), random.randint(0, game.RES[1])))
     self._generate_image()
Beispiel #6
0
    def __init__(self, pos, width, height, color, max_value):
        SpriteBase.__init__(self, pos)
        self.stay = False
        self.stay_time = 0

        self.meter_width = width
        self.meter_height = height
        self.color = color
        self.max_value = max_value

        self._value = 0
        self._generate_image()
Beispiel #7
0
 def __init__(self, pos, icon, text, color):
     SpriteBase.__init__(self, pos)
     if icon:
         self.icon = pygame.image.load(resource_path(icon)).convert_alpha()
     else:
         self.icon = None
     self.text = text
     self.color = color
     self.offset = (0.5,0.5)
     self._generate_image()
     self.time = 0
     self.layer = -1
Beispiel #8
0
 def __init__(self, pos, target, shooter, vel=None, mods=None):
     SpriteBase.__init__(self, pos)
     self.target = target
     self.shooter = shooter
     self.owning_civ = self.shooter.owning_civ
     self.collidable = True
     self.collision_radius = 2
     self.mods = mods or {}
     if vel:
         self.vel = vel
     else:
         self.vel = (self.get_target_pos() - self.pos).normalized() * VEL
     self.offset = (0.5, 0.5)
     self.time = 0
     self._generate_image()
Beispiel #9
0
    def __init__(self, pos, width, height, color, max_value, tick_x=None):
        SpriteBase.__init__(self, pos)
        self.stay = False
        self.stay_time = 0

        self.flash_time = 0

        self.meter_width = width
        self.meter_height = height
        self.color = color
        self.max_value = max_value

        self._value = 0
        self._apparent_value = 0
        self.tick_x = tick_x
        self._generate_image()
Beispiel #10
0
 def __init__(self, pos, icon, text, color):
     SpriteBase.__init__(self, pos + V2(0, -2))
     if icon:
         try:
             self.icon = pygame.image.load(
                 resource_path(icon)).convert_alpha()
         except:
             print("BAD ICON: %s" % icon)
             self.icon = None
     else:
         self.icon = None
     self.text = text
     self.color = color
     self.offset = (0.5, 0.5)
     self._generate_image()
     self.time = 0
     self.layer = -1
Beispiel #11
0
 def __init__(self,
              pos,
              meter_width,
              min,
              max,
              onchange=None,
              value=None,
              disabled=False,
              disable_nums=None):
     SpriteBase.__init__(self, pos)
     self.meter_width = meter_width
     self.min = min
     self.max = max
     self.disabled = disabled
     if value is None: self.value = self.min
     else: self.value = value
     self.selectable = True
     self.onchange = onchange
     self.disable_nums = []
     if disable_nums:
         self.disable_nums = disable_nums
     self._generate_image()
Beispiel #12
0
 def __init__(self, pos):
     SpriteBase.__init__(self, pos)
     self._generate_image()
Beispiel #13
0
 def __init__(self, pos, data):
     SpriteBase.__init__(self, pos)
     self.data = data
     self._generate_image()
Beispiel #14
0
 def __init__(self):
     SpriteBase.__init__(self, V2(0, 0))
     self._layer = -1
Beispiel #15
0
 def __init__(self, object):
     self.object = object
     SpriteBase.__init__(self, object.pos)
     self.offset = (0.5, 0.5)
     self._generate_image()
Beispiel #16
0
 def __init__(self, a, b):
     SpriteBase.__init__(self, a.pos)
     self.obj_a = a
     self.obj_b = b
     self._timers['off'] = 0
     self._generate_image()
Beispiel #17
0
 def __init__(self, start, end, color):
     self.pt1 = ptmin(start, end)
     self.pt2 = ptmax(start, end)
     self.color = color
     SpriteBase.__init__(self, self.pt1)
     self._generate_image()
Beispiel #18
0
 def __init__(self):
     SpriteBase.__init__(self, V2(0, 0))
     self._layer = -1
     self.last_end = None
     sound.play("short3")