Ugh....Another noobish question, Soz.
As an experience MMF2 user, I have never needed much help but this is a pretty noobish question. How would I make 4 different types of objects follow another in a straight line? I basically want a game were u can rescue people adn once you rescue them they follow you in a line. There are different types of people, therefore I have created them as different active objects. An
Example will be the most anyone can give me here :P
EDIT: Its like an angled top down game.
Thanks
Re: Ugh....Another noobish question, Soz.
Active 2 = X Pos of Active 1 - 20
Active 3 = X Pos of Active 2 - 20
Active 4 = X Pos of Active 3 - 20
Then just move Active 1 around. Should be pretty straightforward I think.
Re: Ugh....Another noobish question, Soz.
what events do I use..That wasn't really best described and Why only the X coordinate?
Re: Ugh....Another noobish question, Soz.
Of course you would use both coordinates. I think that's pretty clear, you would use "always". I think that would look jerky though. Let me see if I come up with something.
Re: Ugh....Another noobish question, Soz.
Please read the edit. Its an Angled top down game.
Re: Ugh....Another noobish question, Soz.
Ah sorry just assumed it was a standard side-view thing. Am at work at the moment so if Ravenius doesn't come up with anything i'll post something tonight.
Re: Ugh....Another noobish question, Soz.
steven that works but
1. They arent in a straight line. cWell it depends. They don't really need to be in a straight line. At least bunched together as a group following the "Leader"
2. The followers seem to overlap eachother and....Ok I just fixed that. I basically have them set in the bouncy ball movement and When they overlap the movement starts. I made them bounce if they touch eachother but it looks like they are jumping everywere. weird.
3. When the leader stops, the followers bunch around it and start going crazy like changing direction and it gets worse because since I programed it so they bounce when they touch (So they wont overlap) They go even more crazy. It is very good but they bounce too much.
Re: Ugh....Another noobish question, Soz.
You can use distance formulae in an alterable value, to tell how far rescued object 1 is from rescued object 2, and so on.
So you could do this:
//Rename an alterable value in each of the followers to 'Distance'. So we can see at a glance what we're dealing with in the events.
//Find the distance from each object to the one he'll follow.
//This uses the x_distance² + y_distance² = total_distance² formula.
//So if you times the X distance by itself, and the Y distance by itself, then add them together and find the square root of that number, then you have the distance.
ALWAYS
--- Follower A: Set 'Distance' to:
sqr((x("Follower A")-x("Player")) pow 2 + (y("Follower A")-y("Player")) pow 2)
--- Follower B Set 'Distance' to:
sqr((x("Follower B")-x("Follower A")) pow 2 + (y("Follower B")-y("Follower A")) pow 2)
...and so on for each follower. So Follower A follows player, Follower B follows A, C follows B, and so on and so forth.
//NOW DO THE FOLLOWING FOR EACH FOLLOWER OBJECT:
//If the follower is miles away, he'll run quickly.
Follower: Distance > '80'
--- Follower: Set speed to 20
--- Follower: Look at [object to follow]
//If the follower is a little closer, he can slow down.
Follower: Distance > '40'
Follower: Distance < '80'
--- Follower: Set speed to 10
--- Follower: Look at [object to follow]
//If the follower is very close, he can stop.
Follower: Distance < '40'
--- Follower: Set speed to 0
--- Follower: Look at [object to follow]
I don't really have time to make you an example, but hopefully that's enough for you to get the gist :)
Re: Ugh....Another noobish question, Soz.
There was a great example posted of this, it was like a final fantasy movement, the others would follow you at a certain distance. sorry i don't have a like for ya, but there IS a "follow" example out there...
Re: Ugh....Another noobish question, Soz.
A couple years ago in TGF I did this type of movement for a Dragon Warrior Parody. I don't have the file, but I think I did it like this:
Set the ACTION POINT of the Hero/Hostages several pixels behind the lead character. Have the rescued NPC "Always look in direction of 0,0 ACTION POINT of 'Hero'" and "Set speed to speed of 'Hero'". You can easily code it so the hostages start to follow in a chain. I had 4 characters follow around in a very realistic Dragon Warrior/Secret of Mana style.
I dunno how well it'll work for your game, but it's a quick and dirty fix.