Workaround for grid based movement

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Antonio Nero

I’m searching a workaround for grid based movement of a top-down JRPG style game (only a sketch right now, so I can’t show any project as an example, sorry).

I know there are many tutorials for this, but I think they are too complicated and need a long scripting.

I would ask if a movement based on an amount of pixels could be a solution, and where I can find a tutorial (I’ve found none).

In other terms, I would move a character 16 pixel each step instead giving grid coordinates.

I need a little more information.

-What sort of movement system are you trying to use?

  • Are you trying to move the character using the mouse or with keyboard input?
  • You don’t want the character to move by one grid square at a time, correct?

The navigation system is really simple to use, almost comically so. You could use the set_target() function inside of that to set the target position to 16 pixel to whatever direction key you’re pressing to get this functionality. (if this is even what you’re looking for)

I would stray away from avoiding writing long code also, the more you write the better you’re going to get at it. I’ve only been using Godot for around 40 hour. When I first started I was looking for the shortest code tutorials but then quickly realized I was hindering myself by a large margin.

LordBoots | 2022-12-03 16:48

My sort of movement would be like 2D 16 bit era Pokemon or Final Fantasy. One tile when just press the direction, continuous movement when still pressed.

I understand what you guys are telling me. Learning GDscript well is better than find easier solutions, but I was in search of a short way without affect efficiency. Maybe it exists only with pre-built tools (if there are any in Godot).

Antonio Nero | 2022-12-03 17:56

Wow LordBoots is right completely forgot about the navmesh navigation system.

For what you’re wanting to do though the tile map node seems almost made specifically for you.

There’s an app called AdvanceMap that lets you view how those games layed out their movement

Wakatta | 2022-12-03 20:04

The navigation mesh and navigation agent are already built in. They would give you what you needed. There’s no point trying to reinvent the wheel or you’re never going to get anything done. Once you get through 10 or so tutorials the code would be extremely easy to follow and you should almost just “Know” what you need to do to get the job done.

Don’t avoid reading all of the documentation either. Even if you don’t need it you’ll have moments where you get stuck and then a part of the documentation pops back into your mind like a god given superpower. Happy coding!

LordBoots | 2022-12-03 20:07

:bust_in_silhouette: Reply From: Wakatta

There is a reason you won’t find it, because it’s not practical.

Life seems to operate like water, always taking the path of least resistance.
And if you want to be an excellent programmer you will do well to too.

Not trying to discourage you or say it can’t be done, just advising that the time it takes to create new scripts that create functionality which an already existing library does can be better used to learn an tailor it to your needs.

For example in the grid based movement you’ve mentioned above it’s very easy to achieve that by setting your grid points 16 pixels apart and assigning an index to them.

When faced with a task bigger than yourself the best approach is to break it up into bite sized pieces or delegate the workload.




“Be like water making its way through cracks. Do not be assertive, but adjust to the object, and you shall find a way around or through it. If nothing within you stays rigid, outward things will disclose themselves.

Empty your mind, be formless. Shapeless, like water. If you put water into a cup, it becomes the cup. You put water into a bottle and it becomes the bottle. You put it in a teapot, it becomes the teapot. Now, water can flow or it can crash. Be water, my friend.”

Allan Watts fan?

LordBoots | 2022-12-03 19:21

Ahahahahahaha maybe.
But this here is some raw Bruce Lee man

Wakatta | 2022-12-03 19:59

Ahhh, Never really followed Bruce Lee, Don’t really know why as he was a great philosopher as well as a good fighter for which I have a high affinity for both.

Good answer also. I got stuck in python making a game for years with very little progress as I kept trying to invent the wheel, I was against using pre-made tools, textures and models ( I still only use my models). It took me maybe 40 hours to get a working combat prototype in 3D after opening Godot for the first time.

I’ve heard successful Devs talk about using pre-made tools and the likes for years but I naively ignored them until about 6 weeks ago when I downloaded Godot and realized how much of the workload I had taken off my shoulders.
My worry was always that if I use pre-made tools I would have no clue how to modify them but I’ve already modified my version of Godot once and it wasn’t that big of a task (even without knowing the C languages at all)

LordBoots | 2022-12-03 20:11

Aw now that makes me very proud to hear.

It’s a common pitfall of all those who pursuit a programmatic mind. Problem is we always want to do everything on our own and it’s be proven many times over that our species has progressed this far through team work and relying on each other.

Just look at Blender and even Godot about / license page and you’ll see how many external libraries they use and now imagine where they would they be in their development stage had they decided to build their own from the ground up.

And it’s good that you don’t follow these past philosophers.
We learn best by mimicking others yes, but do you really wanna live doing what others have already done?

The best approach for an inde Dev is to

  • First learn how things are done
  • Use external content, tools, libraries
  • Get core concepts of your game to work
  • Bug fix, tweak, Test, demo
  • replace artwork, external content with your own
  • promote

And within 6- months to a year you can publish a quality product is so be your intentions

Wakatta | 2022-12-03 20:42

That’s exactly my mindset now.

I figured if I can learn every nuance of both Godot and Blender (now two of my favourite software) and then slowly move backwards into my own workflows and software. I’ve already written a few software packages in my short time programming and I do believe that trying to do everything myself has forced me to dig a lot deeper into the code than most would have just following the typical path because I’ve had to implement my own solutions.

I realized a few days ago I can read the C languages no problem without any study on them so I tried my hand at coding a UI element for Godot which is working without a flaw so far, I don’t believe I would be able to do that if I hadn’t climbed down so many rabbit holes.

LordBoots | 2022-12-03 20:56

Really thank you both guys.

I’ll keep in account all of your advice, including navigation mesh and navigation agent.

Antonio Nero | 2022-12-05 18:35