So, I’m trying to make a segmented worm enemy for my 2D game, something like Eater Of Worlds from Terraria. For that I need to be able to tell each segment to follow the one in front. So I’ve given the object I’m using for this a variable and each instance of this object has a different value for this variable. Now I need to be able to select an object based on its internal variable in the parameters for the position in the “Apply force towards position” action. I don’t now how to do that. Someone help.
The first segment properly follows the player, but all the other ones just fly off to the right at a constant speed. As for the Chain allocation, its an object variable tied to the object BouncingBall and each instance on the scene has a different value for that variable, each one greater than the one before it. The starting segment has a value of zero.
Thanks for all your help by the way. I really appreciate it.
The second segment moves towards the position of the first. At the same time, the third segment moves towards the position of the second. And same again for segments 4 & 3, and so on. They all move at the same time.
You can do as @Keith_1357 suggests, though I’m not sure if the clones have hitboxes. If it’s just for visuals, then it should be suitable.
Otherwise, I’d suggest using physics behaviour (without gravity) and a physics joint between subsequent segments.
So I finally tried the animated shadow clone extension, and it works. Plus the shadow clones do have hitboxes. Thank you so much for your help.
The power of extensions in GDevelop is simply amazing. And I love the forum too. I’m happy to be here.