示例#1
0
    def __init__(self):
        #set physics variables
        self.clock = pygame.time.Clock()
        self.__physics_FPS = 100.0
        self.__dt = 1.0 / self.__physics_FPS
        self.time_current = self.get_time()
        self.accumulator = 0.0   
        self.tile_size = 32 
        self.camera = camera.Camera((1280, 720))
        tile_images = {
            "tile_grass": IMAGES.tile_grass,
            "tile_dirt": IMAGES.tile_dirt,
            "tile_wall": IMAGES.tile_wall
        }
        world = WORLD.World("level.map", tile_images)
        self.path_finder = pathfinder.PathFinder(world.nodes)
        player = entity.Player(IMAGES.player)
        dummy = entity.Entity(IMAGES.player, spawn_location = (16, 2))
        self.entities = pygame.sprite.Group(player, dummy)
        self.objects = dict(world=world, player=player, dummy=dummy)

        self.console = console.Console()

        s = item.Sword(IMAGES.key)
        b = item.Bandage(IMAGES.key)
        player.hand.add(s)
        player.bag.add(0, b)
示例#2
0
def build_rooms():
    room = {
            'outside':  Room("Outside Cave Entrance",
                "North of you, the cave mount beckons", {'sword': item.Sword(1)}),

            'foyer':    Room("Foyer", """Dim light filters in from the south. Dusty
                passages run north and east.""", {"lantern": item.Lantern(2)}),

            'overlook': Room("Grand Overlook", """A steep cliff appears before you, falling
                into the darkness. Ahead to the north, a light flickers in
                the distance, but there is no way across the chasm.""",{'hat': item.Item(3, 'hat', 'a miners\' cap')}),

            'narrow':   Room("Narrow Passage", """The narrow passage bends here from west
                to north. The smell of gold permeates the air.""",{'rope': item.Item(4, 'rope', '50 ft of hempen rope')}),

            'treasure': Room("Treasure Chamber", """You've found the long-lost treasure
                chamber! Sadly, it has already been completely emptied by
                earlier adventurers. The only exit is to the south.""",{'chest': item.Item(5,'chest', 'A giant empty chest. How do you plan on carrying this?')}),
            }

    return room
示例#3
0
room['foyer'].n_to = room['overlook']
room['foyer'].e_to = room['narrow']
room['overlook'].s_to = room['foyer']
room['narrow'].w_to = room['foyer']
room['narrow'].n_to = room['treasure']
room['treasure'].s_to = room['narrow']

#
# Main
#
room['outside'].items.add_to_store(
    item.Item("Gold", "The Currency of the Capital", 100))
room['treasure'].items.add_to_store(
    item.Item("Gold", "The Currency of the Capital", 1000))
room['foyer'].items.add_to_store(item.Dagger())
room['overlook'].items.add_to_store(item.Sword())

print('n' in "nsew")


def move(direction):
    player.move("".join(direction[0]))


def say(saying):
    print(f'You said {" ".join(saying)}')


def search():
    print(player.location.search())
示例#4
0
 def __init__(self, model, name='Warrior', level=1, HP=9,strength=5,defense=2,agility=1,intelligence=1,movement=5, xpToNextLevel=100, weapontype=item.Sword(), location=(2*ref,3*ref), dodge = 5 , crit=5, team=1, can_move = False):
     Character.__init__(self,model, name,level, HP,strength,defense,agility,intelligence,movement, xpToNextLevel,weapontype,location, dodge, crit, team)
     self.images = {'s':pygame.image.load('fe_model/images/Bot_stationary.png'),'w':pygame.transform.flip(pygame.image.load('fe_model/images/Bot_stationary.png'),True,False),'n':pygame.transform.flip(pygame.image.load('fe_model/images/bot_Stationary_Back.png'),True,False),'e':pygame.image.load('fe_model/images/bot_Stationary_Back.png')}
     self.image = self.images[self.orient]