CodeX

Everything connected with Tech & Code. Follow to join our 1M+ monthly readers

Follow publication

Implementing 2D point-and-click navigation (Godot 4/C#)

Let’s see how to use Godot’s built-in nav utilities to move a unit through a field of asteroids!

Mina Pêcheux
CodeX
Published in
12 min readFeb 22, 2024

Moving the player’s avatar or AI units in your game level can sometimes seem difficult, especially when there are a bunch of walls and obstacles everywhere the characters need to avoid.

Luckily, in Godot, navigating in a scene in an intelligent way is really easy — so, today, let’s explore how this works by setting up a simple 2D point-and-click nav system :)

By the end of this video, you’ll know how to get a mouse-clicked position on the screen, and how to have a unit navigate to this spot in a clever way, while avoiding the obstacles on the way:

As usual, since we’ll be coding our logic in C#, make sure that you have a version of Godot with .NET enabled.

Download a version of Godot with .NET support, to be able to program in C#! :)

And of course, don’t forget that you can get the demo scene and all the assets for this example on my Github 🚀 with all my other Godot tutorials :)

Also, the assets are from Kenney’s library🚀

The tutorial is also available as a video — text version is below:

Oh and — by the way…

If you want to learn more about 2D tools for your future Godot 4/C# game projects, go ahead and check out my brand new “short-read” ebook: L’Almanach: Mini-2D Platformer!

This quick, practical guide will teach you the fundamentals of doing 2D games in this…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

CodeX
CodeX

Published in CodeX

Everything connected with Tech & Code. Follow to join our 1M+ monthly readers

Mina Pêcheux
Mina Pêcheux

Written by Mina Pêcheux

I’m a freelance full-stack web & game developer. I’m passionate about topics like CGI, music, data science and more! Find me at: https://minapecheux.com :)

No responses yet