def __init__(self, x, y): GameObject.__init__(self, x, y, 0, 0, visible=False) self._visible_time = c.frame_rate * 2 self._visible_timing = self._visible_time self._text = '' self._text_object = TextObject(self.centerx, self.centery, lambda: self._text, colors.YELLOW1, c.font_name, c.font_size, back_color=colors.BLACK)
def __init__(self, surface: Surface, position: (int, int)): GameObject.__init__(self, surface) # Save sprite self._original_image = surface self._disabled_image = surface.copy() self._disabled_image.fill((255, 255, 255, 128), None, pygame.BLEND_RGBA_MULT) self.move(Vector2(position[0], position[1])) self._player: Player = None
def __init__(self, exit_func): GameObject.__init__( self, c.hand_offset_x, 2 * c.hand_offset_y + c.hand_h, c.hand_w, c.screen_height - 4 * c.hand_offset_y - 2 * c.hand_h) self._subscribers = [] self._beaten = Beaten() self._deck = Deck() self._trump = random.choice(c.suits) bottom_player_pool = [] top_player_pool = [] self._players_pools = [bottom_player_pool, top_player_pool] self._alarm = Alarm(self.centerx, self.centery - c.font_size // 2) self._beat = False self._beat_in = 0 self._exit_func = exit_func
def __init__(self, at_bottom): self._at_bottom = at_bottom if self._at_bottom: y = c.screen_height - 2 * c.hand_offset_y - c.card_h else: y = 0 GameObject.__init__(self, 0, y, c.hand_w, c.hand_h) EventsHandler.__init__(self) self._cards = [] self._settle() self._up_card = None # Карта, готовая отправиться на стол. self._table_card = None
def __init__(self, x, y, w, h, text, on_click=lambda x: None, padding=0, active=True): GameObject.__init__(self, x, y, w, h) EventsHandler.__init__(self, active) self._state = 'normal' self._on_click = on_click self._text = TextObject(x + padding, y + padding, lambda: text, c.button_text_color, c.font_name, c.font_size)
def __init__(self): GameObject.__init__(self, c.screen_width - c.card_w - 5, c.screen_height // 2 - c.card_h // 2, c.card_w, c.card_h) self._image = pygame.transform.smoothscale(c.flop, (self.width, self.height)) self._cards = [] self._fill_deck() self._shuffle() self._trump_card = self._cards[0] self._trump_card.turn_90() self._trump_card.show() def size_text_func(): return str(self.size) self._size_text = TextObject(self.left + 12, self.top + 5, size_text_func, colors.YELLOW1, c.font_name, c.font_size, colors.BLACK)
def __init__(self, x, y, suit, nominal): GameObject.__init__(self, x, y, c.card_w, c.card_h) EventsHandler.__init__(self) self._hidden = True self._below = True self._moved = False self._state = 'normal' self._dest_point = (self.left, self.top) self._cur_point = (self.left, self.top) self._suit = suit self._nominal = nominal image_path = 'source/images/cards/' + self._suit + '/' + self._nominal + '.png' image = pygame.image.load(image_path) self._image = pygame.transform.smoothscale(image, (c.card_w, c.card_h)) self._flop = pygame.transform.smoothscale(c.flop, (c.card_w, c.card_h)) self._hover_bounds = pygame.transform.smoothscale( c.hover_bounds, (c.card_w, c.card_h))
def __init__(self, area: Rect, color: Color, background_color: Color = TRANSPARENT, maximum: float = 1, value: float = 0, reverse=False): surface: Surface = Surface((area.width, area.height), flags=SRCALPHA) surface.fill(color) GameObject.__init__(self, surface) self._area = area self._color: Color = color self._background_color: Color = background_color self._max: float = maximum self._reverse = reverse self.__percent: float self.__dirty: bool = True self.value = value self.move(Vector2(area.x, area.y))
def __init__(self, text='YOU DIED', subtext='VONOROF\'S VILLAGE HAVE BEEN WIPED'): death_screen_background_surface = Surface((1024, 768), flags=SRCALPHA) death_screen_background_surface.fill((100, 100, 100, 200)) font = pyfont.Font(GlobalSettings.FONT, 33) text_surface: Surface = DeathScreen.render_font(font, text) death_screen_background_surface.blit(text_surface, InformationBanner.title_text_placer(death_screen_background_surface, text_surface)) font = pyfont.Font(GlobalSettings.FONT, 19) text_surface: Surface = DeathScreen.render_font(font, subtext) death_screen_background_surface.blit( text_surface, InformationBanner.content_text_placer( death_screen_background_surface, text_surface ) ) GameObject.__init__(self, death_screen_background_surface) self.__reset_time = time.time() + 5
def __init__(self, title: str, content: str, duration: float): banner_background_surface = Surface((1024, 150), flags=SRCALPHA) banner_background_surface.fill((111, 111, 111, 200)) font = pyfont.Font(GlobalSettings.FONT, 33) text_surface: Surface = InformationBanner.render_font( font, title.upper()) banner_background_surface.blit( text_surface, InformationBanner.title_text_placer(banner_background_surface, text_surface)) font = pyfont.Font(GlobalSettings.FONT, 19) text_surface: Surface = InformationBanner.render_font( font, content.upper()) banner_background_surface.blit( text_surface, InformationBanner.content_text_placer(banner_background_surface, text_surface)) GameObject.__init__(self, banner_background_surface) self._duration = duration self._death_time = 0
def __init__(self, surface: Surface, path_creator: Callable[[], Generator], start_on_creation: bool = True): GameObject.__init__(self, surface) self.__path_creator = path_creator self.__path_generator = None if start_on_creation: self.start()
def __init__(self, surface: Surface, weight: float): GameObject.__init__(self, surface) PhysicsReceiver.__init__(self, weight)