Exemple #1
0
def Create_Entities(world, Room):
    num_monsters = tcod.random_get_int(0, 0, MAX_ROOM_MONSTERS)
    for i in range(num_monsters):
        # choose random spot for this monster
        x = tcod.random_get_int(0, Room.x1 - 1, Room.x2 - 1)
        y = tcod.random_get_int(0, Room.y1 - 1, Room.y2 - 1)

        if tcod.random_get_int(0, 0, 100) < 80:  # 80% chance of getting an orc
            # create an orc
            world.create_entity(Components.Entity(), Components.Position(x, y),
                                Components.Render(True, 'O', tcod.black, False),
                                Components.Can_Move(True), Components.Health(tcod.random_get_int(0, 3, 5), 5),
                                Components.Alive(True), Components.Name('Orc'), Components.Move_Through(False))
        else:
            # create a troll
            world.create_entity(Components.Entity(), Components.Position(x, y),
                                Components.Render(True, 'T', tcod.black, False),
                                Components.Can_Move(True), Components.Health(tcod.random_get_int(0, 3, 5), 5),
                                Components.Alive(True), Components.Name('Troll'), Components.Move_Through(False))
    return
Exemple #2
0
def Create_Character(world, Player_X, Player_Y):
    # Create a Player Character
    Player = world.create_entity(Components.Player(),
                                 Components.Position(Player_X, Player_Y),
                                 Components.Render(True, '@', tcod.black, False),  # Add default parts to the PC
                                 Components.Can_Move(True), Components.Health(10, 10), Components.Alive(True),
                                 Components.Action_Points(5), Components.Speed(5),
                                 Components.Can_See(True), Components.Can_Talk(True), Components.Head(10),
                                 Components.Left_Arm(10), Components.Left_Hand(5, True), Components.Right_Arm(10),
                                 Components.Right_Hand(5, True), Components.Left_Leg(10), Components.Right_Leg(10),
                                 Components.Move_Through(False), Components.Skills(), Components.Inventory())