smoothly moving through a given path

Started by
22 comments, last by twix 19 years, 8 months ago
Quote:Original post by Tazzel3D
About the collision detection... The only thing I can think of is to not allow diagonal movements in the A* algorithm, if the tiles adjecent to both awypoints are solid. Simply make that kind of move illegal.

This seems like an excellent idea, especially since it also conveniently prevents the player from slipping through an infinitely thin gap between two buildings with corners that meet diagonally. [grin]
Advertisement
well, i only calculate the path one time, when the user clicks the mouse, but i do try to move each frame, if i have a path to walk.

its not just cutting around corners that are the problem. first of all, just to let ya know, im back to using the center of the player to calculate movement. IE, i send the pathfinder my center position, but when i move, i still just move based on my actual x,y position. i couldnt get it to work any other way.

the problem is, i cant figure out how to position the player so that his sprite isnt drawn over any solid tiles. its hard to explain, ummm, maybe ill just show you?


lets say im standing on the left side of a building, like so:


i click where the red dot is. now im moved to this spot:


do you see the problem? the players sprite is drawn over the edge of the building. this happends in all kinds of different situations, but this is just one of them. i cant figure out what exact position to bring the player to so that his sprite isnt drawn over any solid objects. if the player was only the size of a tile, my life would be easy. unfortunately, its not =). any ideas?
FTA, my 2D futuristic action MMORPG
I don't understand why even the player's width is so much bigger than a tile that that can happen... why did you design it this way in the first place?

The only way I can think of is to make more nodes impassable. If a node is less than half the player's width away from a solid object, it shouldn't be available for movement. I imagine you can generate this sort of information with an offline tool, but I'd reconsider the tile design first, if I were you.
Actually, you could try applying this:
Quote:
-check to see if the player can move where he wants
-if so, move him there
-if it contains a wall, move him to the edge of this wall

to each of your pathfinding nodes. It should help, I think.

This topic is closed to new replies.

Advertisement