Sign in to follow this  

2D Tilemap pathfinding

Recommended Posts

Hey everyone!

May not be the right subforum so sorry if its not.

Anyways Im working on a little game of mine with a 2D tilemap.

I've implemented "click to move" and A* for pathfinding on my map.

Problem is that I dont want movement to be from tile to tile.

I would like to be able to click a few pixels from my character and move him there without him always going to the center of the tile I clicked on.

I guess one solution would be dividing my tiles into several smaller nodes for the pathfinding and thus making it less notisable but this would slow down the pathfinding I guess.

Anyone have any theory on how I could acomplish this or perhaps any links to share?

Thanks for any help!


Share this post

Link to post
Share on other sites
You could define offsets that they should move to within the tile. When you determine your path, just set the last way point to use the offset of where the mouse clicked within the tile. This could also be helpful, especially if you have objects that overlap portions of a tile, but not enough to make it impassible. That way they will move around the objects.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this