Esempio n. 1
0
    def __init__(self, map_background: pygame.Surface):
        self.passables = pygame.sprite.Group()
        self.rect = pygame.Rect(3000, 1500, 288, 544)
        self.floor = get_stone_cross_floor(self.rect.w, self.rect.h)
        self.walls = get_stone_cross_wall(288, 544)
        self.pews = get_pews()
        altar = get_altar()
        map_background.blit(self.floor, (self.rect.x, self.rect.y))
        map_background.blit(self.walls, (self.rect.x, self.rect.y))
        pew_coords = [(self.rect.x + 112, self.rect.y + (int(
            (544 - 32) * 7 / 16) + 48)),
                      (self.rect.x + 112, self.rect.y + (int(
                          (544 - 32) * 7 / 16) + 96)),
                      (self.rect.x + 112, self.rect.y + (int(
                          (544 - 32) * 7 / 16) + 144)),
                      (self.rect.x + 112, self.rect.y + (int(
                          (544 - 32) * 7 / 16) + 182))]
        for coord in pew_coords:
            map_background.blit(self.pews, coord)
        map_background.blit(altar, ((self.rect.x + 128), (self.rect.y + (int(
            (544 - 32) * 7 / 16) - 64))))
        self.roof = get_church_roof()
        impassable_altar = UpdatableSprite(
            pygame.Rect(self.rect.x + 128, self.rect.y + (int(
                (544 - 32) * 7 / 16) - 64),
                        altar.get_rect().w,
                        altar.get_rect().h))
        # impassable_walls = UpdatableSprite(pygame.Rect(self.))

        self.impassables = pygame.sprite.Group(impassable_altar)
Esempio n. 2
0
 def draw_items(self, map_background: pygame.Surface):
     # items
     shelfL = get_shelf_l()
     shelfM = get_shelf_m()
     painting = get_painting()
     map_background.blit(painting, (self.rect.x + 70, self.rect.y + 5))
     map_background.blit(shelfL, (self.rect.x + 60, self.rect.y + 30))
     map_background.blit(shelfM, (self.rect.x + 120, self.rect.y + 80))
     impassable_shelfL = UpdatableSprite(
         pygame.Rect(self.rect.x + 60, self.rect.y + 30,
                     shelfL.get_rect().w,
                     shelfL.get_rect().h))
     impassable_shelfM = UpdatableSprite(
         pygame.Rect(self.rect.x + 120, self.rect.y + 80,
                     shelfM.get_rect().w,
                     shelfM.get_rect().h))
     self.impassables.add(impassable_shelfL, impassable_shelfM)
Esempio n. 3
0
    def draw_items(self, map_background: pygame.Surface):
        bed = get_bed()

        map_background.blit(bed, (self.rect.x + 25, self.rect.y + 50))
        map_background.blit(bed, (self.rect.x + 145, self.rect.y + 50))

        impassable_beds = [
            UpdatableSprite(
                pygame.Rect(self.rect.x + 25, self.rect.y + 50,
                            bed.get_rect().w,
                            bed.get_rect().h)),
            UpdatableSprite(
                pygame.Rect(self.rect.x + 145, self.rect.y + 50,
                            bed.get_rect().w,
                            bed.get_rect().h)),
        ]

        self.impassables.add(impassable_beds)
Esempio n. 4
0
    def draw_items(self, map_background: pygame.Surface):
        boxes, boxes_x, boxes_y = get_boxes(
        ), self.rect.x + 30, self.rect.y + 100
        cans, cans_x, cans_y = get_cans(), self.rect.x + 150, self.rect.y + 100

        map_background.blit(boxes, (boxes_x, boxes_y))
        map_background.blit(cans, (cans_x, cans_y))
        impassable_boxes = UpdatableSprite(
            pygame.Rect(boxes_x, boxes_y,
                        boxes.get_rect().w,
                        boxes.get_rect().h))
        self.impassables.add(impassable_boxes)
Esempio n. 5
0
 def draw_items(self, map_background: pygame.Surface):
     veggies = get_vegetables(180, 200)
     lemon = get_lemon_basket()
     herbs = get_herbs()
     cheesecabinet = get_cabinet()
     map_background.blit(veggies, (self.rect.x + 5, self.rect.y))
     map_background.blit(lemon, (self.rect.x + 100, self.rect.y + 70))
     map_background.blit(herbs, (self.rect.x + 7, self.rect.y + 5))
     map_background.blit(cheesecabinet, (self.rect.x + 68, self.rect.y + 5))
     map_background.blit(herbs, (self.rect.x + 130, self.rect.y + 5))
     impassable_cheesecabinate = UpdatableSprite(
         pygame.Rect(self.rect.x + 68, self.rect.y + 5,
                     cheesecabinet.get_rect().w,
                     cheesecabinet.get_rect().h))
     self.impassables.add(impassable_cheesecabinate)
Esempio n. 6
0
 def draw_items(self, map_background: pygame.Surface):
     cage, cage_x, cage_y = get_cage(), self.rect.x + 150, self.rect.y + 50
     carpet, carpet_x, carpet_y = get_carpet(
     ), self.rect.x + 60, self.rect.y + 95
     boxes, boxes_x, boxes_y = get_boxes(
     ), self.rect.x + 30, self.rect.y + 100
     cans, cans_x, cans_y = get_cans(), self.rect.x + 150, self.rect.y + 100
     bear, bear_x, bear_y = get_bear(), self.rect.x + 100, self.rect.y + 100
     map_background.blit(cage, (cage_x, cage_y))
     map_background.blit(carpet, (carpet_x, carpet_y))
     map_background.blit(boxes, (boxes_x, boxes_y))
     map_background.blit(cans, (cans_x, cans_y))
     map_background.blit(bear, (bear_x, bear_y))
     impassable_boxes = UpdatableSprite(
         pygame.Rect(boxes_x, boxes_y,
                     boxes.get_rect().w,
                     boxes.get_rect().h))
     self.impassables.add(impassable_boxes)
Esempio n. 7
0
    def draw_items(self, map_background: pygame.Surface):
        bed_left = get_sideways_bed()
        bed_right = pygame.transform.flip(bed_left, True, False)

        map_background.blit(bed_left, (self.rect.x + 8, self.rect.y + 50))
        map_background.blit(bed_right, (self.rect.x + 130, self.rect.y + 50))

        map_background.blit(bed_left, (self.rect.x + 8, self.rect.y + 100))
        map_background.blit(bed_right, (self.rect.x + 130, self.rect.y + 100))

        map_background.blit(bed_left, (self.rect.x + 8, self.rect.y + 150))
        map_background.blit(bed_right, (self.rect.x + 130, self.rect.y + 150))
        impassable_beds = [
            UpdatableSprite(
                pygame.Rect(self.rect.x + 8, self.rect.y + 50,
                            bed_left.get_rect().w,
                            bed_right.get_rect().h)),
            UpdatableSprite(
                pygame.Rect(self.rect.x + 130, self.rect.y + 50,
                            bed_right.get_rect().w,
                            bed_right.get_rect().h)),
            UpdatableSprite(
                pygame.Rect(self.rect.x + 8, self.rect.y + 100,
                            bed_left.get_rect().w,
                            bed_right.get_rect().h)),
            UpdatableSprite(
                pygame.Rect(self.rect.x + 130, self.rect.y + 100,
                            bed_left.get_rect().w,
                            bed_right.get_rect().h)),
            UpdatableSprite(
                pygame.Rect(self.rect.x + 8, self.rect.y + 150,
                            bed_left.get_rect().w,
                            bed_right.get_rect().h)),
            UpdatableSprite(
                pygame.Rect(self.rect.x + 130, self.rect.y + 150,
                            bed_left.get_rect().w,
                            bed_right.get_rect().h)),
        ]

        self.impassables.add(impassable_beds)
Esempio n. 8
0
    def __init__(self, player: Player, game_state: GameState):
        self.player = player

        # I don't like this. - Davy
        self.player.map = self

        self.game_state = game_state
        self.image = self.compose_image()
        self.map_view_x = WIDTH
        self.map_view_y = HEIGHT
        self.width = self.image.get_rect().width
        self.height = self.image.get_rect().height
        self.move_amount = 10
        self.moved_last_tick = False
        self.footstep = get_sound("footstep-medium.ogg")
        self.footstep.set_volume(0.2)

        # create permanent sprites
        # TODO: Make the forest border out of proper sprites (that own blitting themselves onto the map)
        top_forest = UpdatableSprite(pygame.Rect(0, 0, MAP_WIDTH, HEIGHT//2))
        left_forest = UpdatableSprite(pygame.Rect(0, 0, WIDTH//2, MAP_HEIGHT))
        right_forest = UpdatableSprite(pygame.Rect(MAP_WIDTH - WIDTH//2, 0, WIDTH//2, MAP_HEIGHT))
        bottom_forest = UpdatableSprite(pygame.Rect(0, MAP_HEIGHT - HEIGHT//2, MAP_WIDTH, MAP_HEIGHT//2))
        self.river = River(self.image)
        self.fire = Fire(1700, 1650)
        self.buildings = {
            "toolshed": ToolShed(1650, 450, self.image),
            "library": Library(2500, 450, self.image),
            "kitchen": Kitchen(1800, 1500, self.image),
            "dorm1": HorizontalDorm(750, 1600, self.image),
            "dorm2": VerticalDorm(1250, 1600, self.image),
            "dorm3": HorizontalDorm(750, 2100, self.image),
            "dorm4": HorizontalDorm(1250, 2100, self.image),
            "stores": Stores(1875, 450, self.image),
            "church": Church(self.image)
        }

        self.bed = Bed(1340, 1650, self.image)
        self.desk = Desk(2500, 550, self.image, self.make_madlibs())
        self.graves = [
            Grave(3260, 1100, 0),
            Grave(3150, 900, 300),
            Grave(3390, 940, 40),
            Grave(3025, 1125, 20),
            Grave(3465, 1160, 340),
            Grave(3260, 1300, 270),
        ]
        self.clothes_line = ClothesLine(1950, 800)
        # how to make demon-y stuff appear
        # self.demon_fire = DemonFire(2000, 800)
        # self.demon = Demon(2000,800)

        # create collision groups
        self.impassables = pygame.sprite.Group(
            top_forest, left_forest, right_forest, bottom_forest,
            self.river, self.bed, self.fire, self.desk, *self.graves, self.clothes_line,
        )
        self.passables = pygame.sprite.Group(self.river.bridges)
        for building in self.buildings.values():
            self.impassables.add(building.impassables)
            self.passables.add(building.passables)

        self.day0 = [
            (None, 'welcome the newcomers'),
            ('kitchen', 'kitchen description'),
            ('toolshed', 'toolshed description'),
            ('library', 'library description'),
            ('church', 'church description'),
            (None, 'end day 0')
        ]