Esempio n. 1
0
    def mainloop(self, surface, event):
        for sprite in self.sprites:
            if sprite.ID == 'PLAYER':
                Player = sprite
            elif sprite.ID == 'BOOK_BI':
                Book_bi = sprite
            elif sprite.ID == 'BOOK_BOB':
                Book_bob = sprite
        surface.blit(self.image, (0, 0))
        self.sprites.draw(surface)

        new_room = 'library'
        from_room = 'library'

        if event.type == KEYDOWN:
            if event.key == K_RETURN:
                if engine.checkBordering(Player, Book_bi) == True:
                    self.talk_with_bookbi(Book_bi, surface)
                if Player.rect.x == 375 and Player.rect.y == 600:
                    tmp = self.exit('bitown')
                    from_room = tmp[0]
                    new_room = tmp[1]
                try:
                    if engine.checkBordering(Player, Book_bob) == True:
                        self.talk_with_bookbob(Book_bob, surface)
                except:
                    pass
            elif event.key in (K_d, K_s, K_a, K_w):
                Player.move(event.key, self.collide_group)

        return (from_room, new_room)
Esempio n. 2
0
    def mainloop(self, surface, event):

        for sprite in self.sprites:  # pull sprites from sprite group to make it easier
            if sprite.ID == 'PLAYER':
                Player = sprite
            elif sprite.ID == 'SIGN':
                Sign = sprite
            elif sprite.ID == 'START':
                Start = sprite

        surface.blit(self.image, (1, 1))
        self.sprites.draw(surface)

        new_room = 'default_room'
        from_room = 'default_room'

        if event.type == KEYDOWN:
            if event.key == K_RETURN:
                if engine.checkBordering(Player, Sign):
                    self.talk_with_sign1(Sign, surface)
                if engine.checkBordering(Player, Start):
                    tmp = self.exit('bitown')
                    from_room = tmp[0]
                    new_room = tmp[1]
            elif event.key in (K_d, K_s, K_a, K_w):
                Player.move(event.key, self.collide_group)

        return (from_room, new_room)
Esempio n. 3
0
    def mainloop(self, surface, event):

        for sprite in self.sprites:
            if sprite.ID == 'PLAYER':
                Player = sprite
            elif sprite.ID == 'POET':
                Poet = sprite
            elif sprite.ID == 'BARTENDER':
                Bartender = sprite

        surface.blit(self.image, (1, 1))
        self.sprites.draw(surface)

        new_room = 'bar'
        from_room = 'bar'

        if event.type == KEYDOWN:
            if event.key == K_RETURN:
                if engine.checkBordering(Player, Bartender) == True:
                    self.talk_with_bartender(Bartender, Player, surface)
                elif engine.checkBordering(Player, Poet) == True:
                    self.talk_with_poet(Poet, surface)
                elif Player.rect.x == 825 and Player.rect.y == 300:
                    tmp = self.exit('bitown')
                    from_room = tmp[0]
                    new_room = tmp[1]

            elif event.key in (K_d, K_s, K_a, K_w):
                Player.move(event.key, self.collide_group)

        return (from_room, new_room)
Esempio n. 4
0
    def mainloop(self, surface, event):
        for sprite in self.sprites:
            if sprite.ID == 'PLAYER':
                Player = sprite
            if sprite.ID == 'BOB':
                Bob = sprite
            if sprite.ID == 'SAVE':
                Save = sprite
            if sprite.ID == 'LOAD':
                Load = sprite

        surface.blit(self.image, (0, 0))
        self.sprites.draw(surface)

        new_room = 'house_bob'
        from_room = 'house_bob'

        if event.type == KEYDOWN:
            if event.key == K_RETURN:
                if engine.checkBordering(Player, Bob) == True:
                    self.talk_with_bob(Bob, surface)
                if engine.checkBordering(Player, Save) == True:
                    self.talk_with_save(Save, surface)
                if engine.checkBordering(Player, Load) == True:
                    self.talk_with_load(Load, surface)
                if Player.rect.x == 450 and Player.rect.y == 0:
                    tmp = self.exit('bitown')
                    from_room = tmp[0]
                    new_room = tmp[1]

            elif event.key in (K_d, K_s, K_a, K_w):
                Player.move(event.key, self.collide_group)

        return (from_room, new_room)
Esempio n. 5
0
    def mainloop(self, surface, event):

        for sprite in self.sprites:  # pull sprites from sprite group to make it easier
            if sprite.ID == 'PLAYER':
                Player = sprite
            elif sprite.ID == 'DOOR':
                Door = sprite
            elif sprite.ID == 'DOOR_BAR':
                Door_bar = sprite
            elif sprite.ID == 'DOOR_BOB':
                Door_bob = sprite
            elif sprite.ID == 'DOOR_PPSHED':
                Door_pickleshed = sprite
            elif sprite.ID == 'DOOR_LIB':
                Door_library = sprite
            elif sprite.ID == 'PICKLEPLANT':
                Pickle_plant = sprite

        for item in self.items:
            if item.ID == 'PICKLE':
                Pickle = item

        surface.blit(self.image, (1, 1))
        self.sprites.draw(surface)

        new_room = 'bitown'
        from_room = 'bitown'

        if event.type == KEYDOWN:
            if event.key == K_RETURN:
                if engine.checkBordering(Player, Door):
                    tmp = self.exit('house1')
                    from_room = tmp[0]
                    new_room = tmp[1]

                elif engine.checkBordering(Player, Door_bar):
                    tmp = self.exit('bar')
                    from_room = tmp[0]
                    new_room = tmp[1]

                elif engine.checkBordering(Player, Door_bob):
                    tmp = self.exit('house_bob')
                    from_room = tmp[0]
                    new_room = tmp[1]

                elif engine.checkBordering(Player, Door_pickleshed):
                    tmp = self.exit('pickleshed')
                    from_room = tmp[0]
                    new_room = tmp[1]

                elif engine.checkBordering(Player, Door_library):
                    tmp = self.exit('library')
                    from_room = tmp[0]
                    new_room = tmp[1]

                elif engine.checkBordering(Player, Pickle_plant):
                    status = progress.getProgress('bi_pickle')
                    #if not Pickle in Player.inventory:
                    if status == 0:
                        ans = ''

                        while not ans in ('yes', 'no'):
                            ans = engine.getInput(
                                (Pickle_plant.lines['unpicked'], ),
                                Pickle_plant.lines['q1'], surface)

                        if ans == 'yes':
                            progress.setProgress('bi_pickle', 2)
                            Player.add_to_inventory((Pickle, ))
                            Pickle_plant.picked = True
                            Pickle_plant.changePicture(2)

                            engine.displayMessage(
                                (Pickle_plant.lines['unpicked2'], ), surface)
                            engine.wait()

                    else:
                        engine.displayMessage((Pickle_plant.lines['picked'], ),
                                              surface)
                        engine.wait()

            elif event.key in (K_d, K_s, K_a, K_w):
                Player.move(event.key, self.collide_group)

        return (from_room, new_room)