Hiya again everyone. It's been a while. Anyway I need to ask you guys how you would do this, because I'm a little stumped on this one.
You remember in the old 2D games where they'd have a worm-like creature whose body was made up of spheres, one sphere/sprite was his head, and a bunch of separate sprites of the same thing went together to make up it's body, and then another for the tail, you know what I mean? Almost like the spheres are joined together as a chain. The 'head' would move around, and the body would follow it, connected to it, creating a nice effect as it would change shape as it turned around and such.
I'm going to be attempting to create one of these creatures, and I'm pretty sure I can do it, but I am a little confused at the moment and haven't yet come up with any ideas of how to do it. So I'd appreciate a few little pointers or notes, or even an explanation of how one of you would do it yourself, you know? You could make a cca file if you wanted to, but I'd enjoy a written explanation too as I like to be able to interpret things.
You need seperate objects for each "section". Basically, the "sections" on the end are the only ones that actually have a movement, ie. the head and tail. The others have their Y and X positions set to the average of the ones they're in between.
This method sucks for certain things but it's the easiest. Don't expect to get a natural "wriggling" movement from this one though, unless you make every other section move and the others set positions.
For example, section 4 has the following event:
+ Set X position of "section 4" to ((X pos of "section 3")+(X pos of "section 5"))/2
+ Set Y position of "section 4" to ((Y pos of "section 3")+(Y pos of "section 5"))/2
Try giving each bodypart it's own interia in retrospect to the piece infront of it.
(Just a thought)
(head) --> Intera (ypos head = ypos head + value a) .ect
(Body part 2) --> Set x position to ((x pos of "head")+Value A("body part 2")
(Body part 2) --> Set y position to ((y pos of "head")+Value b("body part 2")
// This places the second body part in the same position as the first, but with displacement FROM it.
(body part 2) --> Add Value c of ("body part 2") to value A of ("body part 2")
(body part 2) --> Add Value d of ("body part 2") to value B of ("body part 2")
// This is the interia of the body part two from the first.
If you continue this in a chain, than put simply...
The head will be the leader.
Body part two's interia will equal it's own interia plus the head's interia.
Body part three's interia will equal it's own interia plus the head's interia and the interia of body part two.
Body part four's interia will equal it's own interia plus the head's interia, the interia of body part two and three.
And so on...
Need more explaining?
(Body part 3) --> Set x position to ((x pos of "body part 2")+Value A("body part 3")
(Body part 3) --> Set y position to ((y pos of "body part 2")+Value b("body part 3")
(body part 3) --> Add Value c of ("body part 3") to value A of ("body part 3")
(body part 3) --> Add Value d of ("body part 3") to value B of ("body part 3")
// You would need to fiddle around with the interia of the linked bits to get it to actually "wriggle".
Ummm... how about,
Always : (Body part 2) --> set X interia of ("body part 2")(ie. value C ) to ( zero - ((head's X interia value) /2))
(take away half of the heads interia so that it trails away)
Well in Clickteam products the word Interia is used to talk about X/Y movement of an object, as simple as that. You guys should know that if you've used the tutorials.
Thanks for your little bit of info there, 'Dr Evil Face', it was helpful, I'll try your demo out. The closest I had before was using a bouncing ball movement, but I didn't really want to use MMF's pre-built movements due to limitations. My strategy was to get all of the objects to "follow" the head object
"Snake Rattle and Roll! That was the kewest!" I agree! One of the first games I ever owned.