I was just wondering if anyone knew how to make code where a bunch of guys follows a player controled character. Now, I'm not talking about:
-always
- set direction of follower to look at leader
- set speed = 10
i'm talking about a system where the follower will always follow the leader's path exactly. Anyone who's played cannon fodder or secret of mana should know what I'm talking about. I believe those apple eating snake games uses the same type of logic.
while i'm at it, may as well ask whats a nice filter effect to use for blood. I want something transparent but don't want the ink effect to overlap on top of itself (like the semi-transparent effect).
I can help with the blood effect thing, use the AND ink effect, with the original graphic being fully red, i.e. R255,G00 0,B000. You'll find it just tints the whole area dark red and doesn't show any seams where objects overlap.
The only real ways are to have advanced methods of movement for the followers, or a cheap trick.
The cheap trick would be to have the leader leave behind an active object every "x" milliseconds, and the follower would look at the current object in line, then when it reaches it, add 1 to the # of which object its looking for, if you catch what I'm saying.
The problem with that is that it would take massive amounts of active objects, which is a very bad thing. Instead, you could have your follower record its X/Y position onto a string every "x" milliseconds, and use a string parser to extract the current destination for your follower; have it move to the next one after it reaches those X/Y coordinates.
In other words, theres no simple and effective way to do it. Only one or the other.
I'm sure I've seen some pretty good examples floating around TDC, but can't recall any right now. Frag's is pretty much the active object method. Works with 1 waypoint / follower ratio, and still has a decent effect. Probably the best idea unless you're very familiar with string parsing and game saving/loading techniques.
Hmmm... I'd rather use a more complex way to get better results. I'm searching through DC for examples now actually ... haven't come across anything yet.
ah yes, the blood effect worked beautifully - thank you Trevor of the Asparagus . Now all I need is a follow the leader system and I'll be happy as a clam.
If you want the second player to follow exactly the same path, I would store the first object's coordinates every so often as Pixel Thief said. Store them in an array or something.