Point & click 2D grid movement in Godot 4 using AStarGrid2D

preview_player
Показать описание

In this tutorial we'll take a look at how to move a 2D character to a position clicked by the cursor whilst using AStarGrid2D to also dodge obstacles.

Chapters:

0:00 - 0:24 - Intro
0:25 - 2:12 - Tile map setup
2:13 - 10:47 - Point & click movement
10:48 - 16:52 - Disabling cells
16:53 - 21:02 - Lock player to grid
21:03 - 24:32 - Drawing path
Рекомендации по теме
Комментарии
Автор

ohhh dude, i just changed the movement styled from a grid to a free movement because i couldnt do this :(. Keep making tutorials like this, you're so valuable for newbie game devs like me!

domedevep
Автор

Absolute godsend, you're singlehandedly preventing me from going bald from frustration with this tutorial. Thank you so much.

omelettes
Автор

Hey man I just wanted to let you know that I'm in love with you for making this tutorial. Exactly what I was looking for, concise, clear, fast...be still, my heart

lolxtrach
Автор

Finally, a good example of actually using the grid. I'm planning on making a turn based game with limited movement, but I can take it from here. Thanks for the fantastic starting point!

Slipy
Автор

This video was so valuable to me right now after 2 days trying to figure out how to properly do isometric grid movement and running into walls. By obligation, I have to leave this comment to let you know that a random stranger on the internet appreciates you. Thank you, so much!

JorgeFigueroa-lxrh
Автор

Instant like for showcasing the result at the start of the video

NicoFye
Автор

I love how you print stuff and the screen and explains everything. Great tutorial and amazing teacher.

anonykat
Автор

Thank you! This video is very useful, I'm starting to work on a roguelike game, and this is a great beginning.

Cesardevart-dcpz
Автор

Great overview, wish I'd seen it five months ago when I was trying to work it out. Using single tiles instead of atlas one can define a 'solid' via tile number instead of 'walkable' which is handy for an active map where tiles can change from not solid to solid. 'Tweening' (IE: tween.tween_property($%playerSprite, "position", nextTileLoc, .4) can also be used instead of process.

kindavacant
Автор

i LOVE YOU, THIS IS EXACTLY WHAT i WANTED. It was very interesting because my game has 3d graphics and I was able to use this using a gridmap instead, converting the vector2 to vector3 and viceversa, and shooting a raycast from the camera to know the position. Since my 3d game doesnt have height or layers of land, I only nedeed to move the character on a 2D plane and I also nedeed to do it with squares and without diagonals just like you but in 3D, and this solution is working wonders. Thank you so much.

jorie
Автор

Awesome! Now a third video would be great which combines the A* Point & Click with the 2D Movement video. Keep up the good work!

JohnSane
Автор

Great tutorial, finally understood AStargrid2D after your video

Rafael-wrwi
Автор

I've been struggling with this for days until I found this video, thank you!

Automageddon
Автор

Really great tutorial. Thank you! I hope you got back to making tutorials, since everything was really direct and useful.

socklesshobo
Автор

Just exactly what I was looking for! Thanks for the tutorial!

DrZell
Автор

You are doing a great job, taking on the topics which aren't yet touched, please keep making videos for our new thriving community. We all are rooting for you 🎉

nyxm
Автор

very good, simple and helpful thanks man

BUTTERFLY-eoob
Автор

Great tutorial. You may have convinced me that AStarGrid isn't the way I want to go as it looks complicated, which often means computationally expensive. I have a lot of moving objects.

timflatus
Автор

Amazing work, I was breaking my head trying to do / find somethjng like this

KommissarAlexander
Автор

Thank you for the tutorial it really helped there wasn't even one for Arrow keys. And now for Point and click Thank you so Much.

CosmoCodez