def __init__(self): self.size = pygame.display.get_surface().get_size() self.window = pygame.Surface(self.size, flags=pygame.SRCALPHA) self.rect_size = pygame.Rect((self.size[0] - 300) / 2, (self.size[1] - 200) / 2, 300, 200) self.image = self.window.copy() self.option_button = UI.Button.Button("Options", 0, 0) self.quit_button = UI.Button.Button("Quit Game", 0, 0) self.menu_button = UI.Button.Button("Main Menu", 0, 0) self.end_turn_button = UI.Button.Button("End Turn", 0, 0) self.cancel_button = UI.Button.Button("Cancel Turn", 0, 0) cancel_up_left = (0, self.size[1] - self.cancel_button.get_height()) skip_up_left = (0, self.size[1] - self.cancel_button.get_height() - self.end_turn_button.get_height() - 2) quit_up_left = (0, self.size[1] - self.end_turn_button.get_height() - self.cancel_button.get_height() - self.quit_button.get_height() - 4) menu_up_left = (0, self.size[1] - self.end_turn_button.get_height() - self.cancel_button.get_height() - self.quit_button.get_height() - self.menu_button.get_height() - 6) #option_up_left = (0, self.size[1] - self.end_turn_button.get_height() - self.cancel_button.get_height() - self.quit_button.get_height() - self.menu_button.get_height() - self.menu_button.get_height() - 8) self.image.blit(self.cancel_button.image, cancel_up_left) self.image.blit(self.end_turn_button.image, skip_up_left) self.image.blit(self.quit_button.image, quit_up_left) self.image.blit(self.menu_button.image, menu_up_left) self.image.blit(self.option_button.image, menu_up_left) self.quit_rect = pygame.Rect(quit_up_left, self.quit_button.get_size()) self.skip_rect = pygame.Rect(skip_up_left, self.end_turn_button.get_size()) self.cancel_rect = pygame.Rect(cancel_up_left, self.cancel_button.get_size()) self.menu_rect = pygame.Rect(menu_up_left, self.menu_button.get_size()) #self.option_rect = pygame.Rect(option_up_left, self.option_button.get_size()) self.redraw_right_panel() self.back_to_main_rect = pygame.Rect(0,0,0,0) self.yes_sir_sound = load_sound("yes_sir") self.trumpet_sound = load_sound("trumpet")
def __init__(self, image, pos): self.walk_sound = load_sound("walk") self.die_sound = load_sound("death") self.walk_animation = list() path_str = "images/" + image + "/" self.base_sprite_name = image ActiveTile.__init__(self, path_str + image + "_fr1.gif", pos)
def __init__(self, __type__, __from__, __to__, __gap__ = (0,0)): from_x = __from__[0] + __gap__[0] from_y = __from__[1] + __gap__[1] to_x = __to__[0] * 32 + __gap__[0] to_y = __to__[1] * 32 + __gap__[1] self.speed = [ 0 , 0 ] if from_x > to_x: self.direction = "left" self.speed[0] = -5 if from_x < to_x: self.direction = "right" self.speed[0] = 5 if from_y > to_y: self.direction = "up" self.speed[1] = -5 if from_y < to_y: self.direction = "down" self.speed[1] = 5 self.image = pygame.image.load("images/" + __type__ + "/" + self.direction + ".png") self.missile = self.image.get_rect().move([from_x, from_y]) self.target = pygame.Rect( to_x, to_y, 32, 32) self.battle_sound = load_sound(__type__)
def __init__(self, num_of_players, grid_size): self.total_players = num_of_players self.grid_size = grid_size self.battle_sound = load_sound("sword") self.fanfare_sound = load_sound("fanfare")