00:00
00:00
Newgrounds Background Image Theme

mariobros22 just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

[as2] V-cam: Follow Multiple Mc's?

996 Views | 9 Replies
New Topic Respond to this Topic

Im familar with a regular V-cam, following one mc and all. but how would you follow 5 Movieclips at once and only up to a certain extent?

in other words, A Super Smash Bros. Camera effect.

In Super Smash Bros, the camera follows all 4 players AND the stage. But if the player jumps out to a certain extent away from the camera, the camera stops following that player and stays in one place until the player dies, or comes back to the stage.

I want to make a V-cam like that. does any one know how to go about this?

Response to [as2] V-cam: Follow Multiple Mc's? 2012-05-12 22:06:29


At 5/12/12 09:54 PM, PsycoMunkey wrote: Im familar with a regular V-cam, following one mc and all. but how would you follow 5 Movieclips at once and only up to a certain extent?

in other words, A Super Smash Bros. Camera effect.

In Super Smash Bros, the camera follows all 4 players AND the stage. But if the player jumps out to a certain extent away from the camera, the camera stops following that player and stays in one place until the player dies, or comes back to the stage.

I want to make a V-cam like that. does any one know how to go about this?

Calculate distances between players or players and the stage and then scale and move your camera according to those factors.


...

Response to [as2] V-cam: Follow Multiple Mc's? 2012-05-12 22:11:58


To expand further because I didn't explain myself very well.

Say for example you had two players the camera would get larger if the distance between those two characters increased so that it always encompassed both of them.
Calculate the mid point between the two characters and then focus the camera on that point this way the camera follows the movement of the characters around the stage whilst expanding and contracting to fit both the players on screen.


...

Response to [as2] V-cam: Follow Multiple Mc's? 2012-05-12 22:17:52


At 5/12/12 10:11 PM, the1manwiththeplan wrote: To expand further because I didn't explain myself very well.

Say for example you had two players the camera would get larger if the distance between those two characters increased so that it always encompassed both of them.
Calculate the mid point between the two characters and then focus the camera on that point this way the camera follows the movement of the characters around the stage whilst expanding and contracting to fit both the players on screen.

ahhhh i see. so would that mean I would have to add the _x and _y of all MC's and divide? because if so, that would be a pain...cause im using attach movie for my MC's, so i dont want it to follow player 3 if player 3 is not present, but the empty mc that holds it IS present. how would I prevent this?

Response to [as2] V-cam: Follow Multiple Mc's? 2012-05-12 22:27:27


At 5/12/12 10:17 PM, PsycoMunkey wrote:
At 5/12/12 10:11 PM, the1manwiththeplan wrote: To expand further because I didn't explain myself very well.

Say for example you had two players the camera would get larger if the distance between those two characters increased so that it always encompassed both of them.
Calculate the mid point between the two characters and then focus the camera on that point this way the camera follows the movement of the characters around the stage whilst expanding and contracting to fit both the players on screen.
ahhhh i see. so would that mean I would have to add the _x and _y of all MC's and divide? because if so, that would be a pain...cause im using attach movie for my MC's, so i dont want it to follow player 3 if player 3 is not present, but the empty mc that holds it IS present. how would I prevent this?

You could push all the new added players into an array then loop through all new players added to the stage to calculate the midpoint between them.

for (i = 0 ; i < playerArray.length ; i++)
{
	var currentPlayer:MovieClip = playerArray[i];
	
	//Check for midpoint between all characters here
	
	vcam.x = midPointVariableX
	vcam.y = midpointVariableY

}

This way you could add 100 players and the vcam would still move accordingly.


...

Response to [as2] V-cam: Follow Multiple Mc's? 2012-05-12 22:51:58


At 5/12/12 10:27 PM, the1manwiththeplan wrote:
At 5/12/12 10:17 PM, PsycoMunkey wrote: ahhhh i see. so would that mean I would have to add the _x and _y of all MC's and divide? because if so, that would : : :be a pain...cause im using attach movie for my MC's, so i dont want it to follow player 3 if player 3 is not present, but : : :the empty mc that holds it IS present. how would I prevent this?
You could push all the new added players into an array then loop through all new players added to the stage to :calculate the midpoint between them.

for (i = 0 ; i < playerArray.length ; i++)
{
var currentPlayer:MovieClip = playerArray[i];

//Check for midpoint between all characters here

vcam.x = midPointVariableX
vcam.y = midpointVariableY

}

This way you could add 100 players and the vcam would still move accordingly.

I mostly understand but...

how would I use the playerArray in this? i was thinking of using playerArray[i], but that wont work...how would i tell the vcam follow only the players in the array? arrays can be a little tricky in this situation...

Response to [as2] V-cam: Follow Multiple Mc's? 2012-05-13 01:05:56


Nevermind, I just realized how dumb that question was.

but im trying to use this, and there is one problem: I have to use it on the character select screen so it can detect when the array changes. kinda like "when i select this char, do this loop, and add to the playerArray."

but when i do this, it will have no way to define the player's x or y, since they arent on the same frame, but two frames after.

this is the only problem now.

Response to [as2] V-cam: Follow Multiple Mc's? 2012-05-14 16:21:50


The easiest method is contain the whole thing in a movieclip and just zoom in on that and apply your math and ranges there versus targeting every asset individually. If you're doing fancy zooms to give the illusion of greater distance with different z-axis level it won't work and you'll need to run a loop, but this works fine for most things and give you control of the thing as a whole so you can 'shake' the screen if you felt like easily.

Response to [as2] V-cam: Follow Multiple Mc's? 2012-05-14 16:23:21


bah ignore prev post reread the OP.

Response to [as2] V-cam: Follow Multiple Mc's? 2012-05-14 16:56:36


-____- I feel so stupid.

Thats it! Just put all of the MCs into One, and target the Main holder MC.....

I should've thought of that way before.

thanks dude, im gonna do that.