Пример #1
0
    def __init__(self):
        from Scripts.Util.ScaleImage import scale_image
        img_tilemap_guy = pygame.image.load("../Graph/chars/guy/guy_BW.png")

        self.img_guy_BW = {
            "head": img_tilemap_guy.subsurface((0, 0, 64, 64)),
            "shirt": img_tilemap_guy.subsurface((64, 0, 64, 64)),
            "pants_sit": img_tilemap_guy.subsurface((128, 0, 64, 64)),
            "shoes_sit": img_tilemap_guy.subsurface((192, 0, 64, 64)),
            "shoes_walk0": img_tilemap_guy.subsurface((0, 64, 64, 64)),
            "shoes_walk1": img_tilemap_guy.subsurface((64, 64, 64, 64)),
            "shoes_walk2": img_tilemap_guy.subsurface((128, 64, 64, 64)),
            "shoes_walk3": img_tilemap_guy.subsurface((192, 64, 64, 64)),
            "hands_sit": img_tilemap_guy.subsurface((0, 128, 64, 64)),
            "hands_walk1": img_tilemap_guy.subsurface((64, 128, 64, 64)),
            "hands_walk2": img_tilemap_guy.subsurface((128, 128, 64, 64)),
            "hands_walk3": img_tilemap_guy.subsurface((192, 128, 64, 64)),
            "pants_walk2": img_tilemap_guy.subsurface((128, 192, 64, 64)),
            "pants_walk3": img_tilemap_guy.subsurface((192, 192, 64, 64))
        }

        self.img_head_bw, _ = scale_image(self.img_guy_BW["head"], 300)
        self.img_head = self.img_head_bw.copy()
        self.img_shirt_bw, _ = scale_image(self.img_guy_BW["shirt"], 300)
        self.img_shirt = self.img_shirt_bw.copy()
        self.img_pants_bw, _ = scale_image(self.img_guy_BW["pants_sit"], 300)
        self.img_pants = self.img_pants_bw.copy()
        self.img_shoes_bw, _ = scale_image(self.img_guy_BW["shoes_sit"], 300)
        self.img_shoes = self.img_shoes_bw.copy()
        self.img_hands_bw, _ = scale_image(self.img_guy_BW["hands_sit"], 300)
        self.img_hands = self.img_hands_bw.copy()
        self.img_w, self.img_h = self.img_head.get_size()
Пример #2
0
 def draw_portraits(self, win):
     self.portrait_w = 150
     portrait_scaled, self.portrait_h = scale_image(self.players[0].portrait, self.portrait_w)
     text = self.players[0].name
     text_rendered = font.render(text, 0, self.players[0].textcolor)
     text_w, self.text_h = font.size(text)
     win.blit(text_rendered, (win_SHIFTX + win_WIDTH / 2 - text_w / 2, win_SHIFTY + win_HEIGHT - self.text_h))
     win.blit(portrait_scaled, (win_SHIFTX + win_WIDTH / 2 - SCALED_WIDTH / 2, win_SHIFTY + win_HEIGHT -
                                self.portrait_h - self.text_h))
     for p in range(1, self.nr_players):
         portrait_scaled = scale_image(self.players[p].portrait, 150)[0]
         portrait_h = portrait_scaled.get_height()
         text = self.players[p].name
         text_rendered = font.render(text, 0, self.players[p].textcolor)
         text_w, self.text_h = font.size(text)
         x_shift = win_WIDTH / self.nr_players
         win.blit(text_rendered, (win_SHIFTX + x_shift * p - text_w / 2, win_SHIFTY))
         win.blit(portrait_scaled, (win_SHIFTX + x_shift * p - SCALED_WIDTH / 2, win_SHIFTY + self.text_h))
Пример #3
0
    "shirt": img_tilemap_guy.subsurface((64, 0, 64, 64)),
    "pants_sit": img_tilemap_guy.subsurface((128, 0, 64, 64)),
    "shoes_sit": img_tilemap_guy.subsurface((192, 0, 64, 64)),
    "shoes_walk0": img_tilemap_guy.subsurface((0, 64, 64, 64)),
    "shoes_walk1": img_tilemap_guy.subsurface((64, 64, 64, 64)),
    "shoes_walk2": img_tilemap_guy.subsurface((128, 64, 64, 64)),
    "shoes_walk3": img_tilemap_guy.subsurface((192, 64, 64, 64)),
    "hands_sit": img_tilemap_guy.subsurface((0, 128, 64, 64)),
    "hands_walk1": img_tilemap_guy.subsurface((64, 128, 64, 64)),
    "hands_walk2": img_tilemap_guy.subsurface((128, 128, 64, 64)),
    "hands_walk3": img_tilemap_guy.subsurface((192, 128, 64, 64)),
    "pants_walk2": img_tilemap_guy.subsurface((128, 192, 64, 64)),
    "pants_walk3": img_tilemap_guy.subsurface((192, 192, 64, 64))
}

img_head_bw, _ = scale_image(img_guy_BW["head"], 300)
img_head = img_head_bw.copy()
img_shirt_bw, _ = scale_image(img_guy_BW["shirt"], 300)
img_shirt = img_shirt_bw.copy()
img_pants_bw, _ = scale_image(img_guy_BW["pants_sit"], 300)
img_pants = img_pants_bw.copy()
img_shoes_bw, _ = scale_image(img_guy_BW["shoes_sit"], 300)
img_shoes = img_shoes_bw.copy()
img_hands_bw, _ = scale_image(img_guy_BW["hands_sit"], 300)
img_hands = img_hands_bw.copy()
img_w, img_h = img_head.get_size()

bw_list = [img_head_bw, img_shirt_bw, img_pants_bw, img_shoes_bw, img_hands_bw]


class CreateChar:
Пример #4
0
def order_tuple(to_order):
    if to_order[0] < to_order[1]:
        t = (to_order[1], to_order[0])
        t = tuple(t)
    else:
        t = tuple(to_order)
    return t


pygame.init()

img_dice_cup = [
    pygame.image.load('../graph/games/cup.png'),
    pygame.image.load('../graph/games/cup_open.png')
]
img_dice_cup = [scale_image(img, 120)[0] for img in img_dice_cup]
img_dice = [
    pygame.image.load('../graph/games/wurf1.png'),
    pygame.image.load('../graph/games/wurf2.png'),
    pygame.image.load('../graph/games/wurf3.png'),
    pygame.image.load('../graph/games/wurf4.png'),
    pygame.image.load('../graph/games/wurf5.png'),
    pygame.image.load('../graph/games/wurf6.png')
]
img_dice = [scale_image(img, 50)[0] for img in img_dice]

img_Buttons = {
    "A": pygame.image.load('../graph/GUI/button_A.png'),
    "W": pygame.image.load('../graph/GUI/button_W.png')
}
img_bg = pygame.image.load('../graph/games/holztisch.png')