Skip to content

Instantly share code, notes, and snippets.

@ozgurozkok
Created May 17, 2023 21:32
Show Gist options
  • Save ozgurozkok/4fd74842b43a7eae972bd56a64d41a83 to your computer and use it in GitHub Desktop.
Save ozgurozkok/4fd74842b43a7eae972bd56a64d41a83 to your computer and use it in GitHub Desktop.
import pygame
from pygame.locals import *
# Create a Navmesh object
navmesh = pygame.nav.NavMesh()
# Load the Navmesh from a file
navmesh.load("navmesh.nav")
# Create a start and end point
start = (0, 0)
end = (100, 100)
# Find the path between the start and end points
path = navmesh.find_path(start, end)
# Draw the path on the screen
for point in path:
pygame.draw.circle(screen, (255, 0, 0), point, 5)
# Update the screen
pygame.display.update()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment