sprite pathfinding around another sprite in grid.

0 favourites
  • 6 posts
From the Asset Store
Snap to visible grid - perfect solution for any game genre
  • So I was wondering if any of you awesome forum people could help me fix a few small things bugging me that I can't for the life of me figure out.

       Here goes: So after many many attempts to create a tactics like movement system, like final fantasy tactics or fire emblem, I managed to get something good working, with a few small things that bug me.

       The hero and the enemy's take turns moving on a 32x32 grid, and can move a certain radius depending on their 'move' stat. To accomplish this I create 'move boxes' in a radius around the sprite that is moving and they can move to any one of the 'move boxes'.

    The problem is the enemy can move through the hero, (not on top of the hero, thanks to destroying 'move boxes' that collide with the hero) to get to a move box on the other side of the hero. Likewise the hero can move through enemy's(but not on top of them) to get to a move box. Very frustrating.

    What I want to happen is if the hero is in the way of the enemy getting to their target move box, they go around the hero. Same with the enemy in the way of the hero getting to it's target move box, that way enemy's can box in the hero if they are surrounding him.

    So TLDR: I need my 'hero' sprite to find a path around a 'enemy' sprite and not go through it, while staying in a 32x32 grid.

    If anybody can understand this jumbo topic please please help

    <img src="smileys/smiley1.gif" border="0" align="middle" /> <img src="smileys/smiley1.gif" border="0" align="middle" />

    I can't post the link to the .capx thanks to the great 'spam' blocking software on this website so if anybody knows a way for me to post it, I have it uploaded.

    <img src="http://oi60.tinypic.com/142rnd0.jpg" border="0" />

    <img src="http://oi57.tinypic.com/2e3u2hw.jpg" border="0" />

  • http://

    2shared

    .com/

    file/MmwR1KLm/tacticgmae

    .html

    haha! Got it, just combine for the link to the .capx file.

  • I'm running into similar problems with my game. Even though my game is a bit different, the goal is the same, to have characters not just walk through each other when pathfinding.

    The problem is that I can get one person to go around the other, but it always screws over the other person.

    I've tried making them solid, which will cause someone to walk around them, but then they can't move at all.

    I tried custom obstacles being added, but I wasn't able to make any progress with that either. Maybe I should look into it more.

    I tried fooling with the path cost, but it didn't seem to do anything. Maybe I was doing it wrong though. I'm fairly new to pathfinding behaviors.

    The problem may be centered around the fact that all is well until the "path obstacle" moves. Regenerating the obstacle map is supposed to be resource intensive, and I don't know if it can be done with things are moving around.

    There are maybe a couple more tricks or workarounds I can play with. I'll try some more tonight.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • A suggested workaround for regenerating obstacle maps was that you move all static objects (non-moving objects) outside the layout area, then regenerating the obstacle map and placing the objects in their original positions.

  • I would think without seeing the capx that all you need is to create a barrier that these two would be forced to go around and then have that be invisible and pin it to the sprites needed to be gone around.

  • The normal path finding behavior dose not work because the sprites won't stay in a 32x32 grid, I also tried a plugin I found called AStar path finding, but that don't work for me because it goes out of the 'movement range' tiles that I need my sprites to stay on. <img src="smileys/smiley19.gif" border="0" align="middle" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)