Ejemplo n.º 1
0
def normal(world: World, pl: Character):
    os.system('setterm -cursor off')
    print()
    direction = "down"
    flag = "none"
    while flag == "none":
        os.system('cls')
        pl.update()
        show_world(world, pl)
        print(statusbar_generate(pl))
        print(itembar_generate(pl, world))
        ch = getwch()
        if ch == "w" or ch == "W":
            world.player_shift(pl, "up")
        elif ch == "a" or ch == "A":
            world.player_shift(pl, "left")
        elif ch == "s" or ch == "S":
            world.player_shift(pl, "down")
        elif ch == "d" or ch == "D":
            world.player_shift(pl, "right")
        elif ch == "e" or ch == "E":
            if pl.item_available(world):
                pl.take(world)
            elif pl.nearest(pl.fov(direction, pl.Current_Gun.Range, world), world.Entity_list):
                attack(pl, world, pl.nearest(pl.fov(direction, pl.Current_Gun.Range, world), world.Entity_list,
                                             ["Hostile", "Tile"]))
        elif ch == "`":
            print("GoodBye!")
            flag = "ExitKey"