Legacy GM Following Party Members Question

I

IncuTyph

Guest
So I'm trying to have some following party members in my game. It's an RPG. Wanted to have a sort of caterpillar following system for party members (think Earthbound or Pokemon Mystery Dungeon). I have been using a ds_queue on the follower object, and it works for the most part. He will get stuck behind things and then snap back to position. Is there a way to make him follow smoother using a ds_queue or should I try an alternative method? I also want to know if there's a way to 'pass' through the party member as well to prevent being stuck in a corner because of him being right next to the player.

Here's the code I have for my follower:
Code:
///CREATE EVENT
//set up a que
Following_que = ds_queue_create();

///STEP EVENT
///Movement while in party
if ppos2 = obj_frisk_party //ppos2 is the p(arty) pos(ition) he's in. Denotes he's supposed to be second in the party line
{
     if obj_player.phy_position_x!= obj_player.xprevious
         {
             ds_queue_enqueue(Following_que,obj_player.phy_position_x)
             ds_queue_enqueue(Following_que,obj_player.phy_position_y)
          }
}

if ds_queue_size(Following_que) >= 30
{
    phy_position_x = ds_queue_dequeue(Following_que)
    phy_position_y = ds_queue_dequeue(Following_que)
}


depth = -y;
As I said, he follows, but gets stuck behind things and teleports to get back behind the player. I've tried tightening the queue to less than 30, but that definitely doesn't help. There is no grid-based movement BTW, just like in Earthbound. I plan to have no more than 3 party members in the line at any time.

Any help is appreciated!
 

TheouAegis

Member
Is it free-roaming or tile-based roaming? If it's tile-based, just store the player's current tile/cell in the follower and have the follower move toward that tile/cell with the player's current speed. So if the player's not moving, the follower doesn't move; but if the player is moving, the follower walks to the player's previous position. For multiple followers, do the same thing, but have each follower store its position in the next follower.
 
I

IncuTyph

Guest
Is it free-roaming or tile-based roaming? If it's tile-based, just store the player's current tile/cell in the follower and have the follower move toward that tile/cell with the player's current speed. So if the player's not moving, the follower doesn't move; but if the player is moving, the follower walks to the player's previous position. For multiple followers, do the same thing, but have each follower store its position in the next follower.
It's free roaming.
 
Top