Пример #1
0
        return False

# Generating the player's initial position randomly
player_need_position = True
while(player_need_position):
    y = random.randint(0,max_y)
    x = random.randint(0,max_x)
    if (rendered_map[x][y] == "."):
        player_need_position = False

# Make the player
player = Creature(140,20,20,"@")

# Put the player onto the map
rendered_map[x][y] = player.symbol
player.move(x,y)

# Print the first iteration of the map
print_map(rendered_map)

# main game loop
while(still_playing):
    
    rendered_map = copy.deepcopy(board)
    d = screen.getkey()
    screen.addstr(len(rendered_map),0,"                     ") # worst hack ever

    # Also, as usual when making dungeon crawlers, x and y are swapped
    if (d == "KEY_UP" and ((x-1) >= 0) and next_step_allowed(x-1,y)):
        x-=1
    elif (d == "KEY_RIGHT" and ((y+1) < len(board[0])) and next_step_allowed(x,y+1)):