I'm trying to figure out the most optimal way to make a caterpillar system from a top-down perspective in 8-directions.
For those of you who aren't sure what a caterpillar system is, it's when you have entities (such as party members) that follow behind the avatar in real time. Secret of Mana on the SNES is a perfect example of the behavior that I'm going for.
I've done as much research as I could and found some ways to achieve this effect but none result in the behavior that I want.
-Pinning each entity to the last using the "rope" setting:
This makes the entities follow the player in a snake-like way which doesn't feel natural and also offers little control over other positioning behaviors.
Because pathfinding is taxing to use when the end of the path is a mobile entity, it's unrealistic to update the path goal frequently enough to have entities consistently follow the player; although it does offer flexibility in terms of positioning.
In Secret of Mana, the characters that follow you are always moving in 8 directions and aren't tightly locked into a caterpillar system, they have some freedom to their movements and the distance between each other when following the avatar; they can also break out of the caterpillar system to perform other actions that require their positioning to be different.
-Caterpillar system is when party members follow the avatar
-Pinning feels weird and gives no freedom
-Pathfinding is too taxing
-Every entity should be locked in 8 direction movement
-Entity movement should feel natural
Here's a video of Secret of Mana for reference:
This is a very challenging task and I would be extremely grateful to get some ideas as to how I could make this happen in Construct 2. Thanks!!
Develop games in your browser. Powerful, performant & highly capable.
You can try a combination of Pin+Pathfinding.
Pin an invisible sprite to your character (with "rope" setting), which will act as a target for Pathfinding. And then use Pathfinding to move the actual party member to that sprite position.
dop2000 thanks for the great suggestion!
It works much more accurately to the behavior that I wanted, unfortunately there are still some issues that I can't seem to figure out.
I'm still unsure as to how I can lock the party member to only move in 8 directions, they still move freely at the moment.
Another issue that I came across is closing the gap in between the avatar and the party member when the avatar is walking. Currently I'm setting the speed of the party member to be equal to the distance in between them and the avatar, which accelerates the party member's speed when theyre far away (so the party member can catch up if the avatar is too far away) but also has the side effect of always being the avatars max speed away in pixels.
Here's a WIP capx: drive.google.com/open
Thanks for the help!
you can combine pathfind with 8direction to move your partymember. I added this to your project:
Also you can take a look on an older example i made to test it myself. You need to open it in C3 ( editor.construct.net ) but the code is compatible with C2:
Keep in mind that a good KI and NPC movement needs more than a handful of lines. It needs some extra work to prevent glitches and bugs.
kriand You did all the work for me! God bless you, I couldn't have asked for a better reply!! I should be ready to proceed now, thanks everyone for the help.