00:00
00:00
Newgrounds Background Image Theme

SonicKoi 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!

As: V- Cam 2006-07-01 13:04:01


AS: Main

V-Cams are an extremely useful peice of flash scripting. They are flash cameras that can be used in sidescrolling games instead of moving a large background.

First, make a Box the size of your canvas. Make sure it is filled with a colour of about 25 % alpha.
Convert it to a movie clip with the instance name : "Cam" without the quotes.
Add a new layer, and make a small circle in the middle of your box. That should also have low alpha.
Add yet another layer, and add this script:

function camControl():Void {
parentColor.setTransform(camColor.getTrans
form());
var scaleX:Number = sX/this._width;
var scaleY:Number = sY/this._height;
_parent._x = cX-(this._x*scaleX);
_parent._y = cY-(this._y*scaleY);
_parent._xscale = 100*scaleX;
_parent._yscale = 100*scaleY;
}
function resetStage():Void {
var resetTrans:Object = {ra:100, rb:0, ga:100, gb:0, ba:100, bb:0, aa:100, ab:0};
parentColor.setTransform(resetTrans);
_parent._xscale = 100;
_parent._yscale = 100;
_parent._x = 0;
_parent._y = 0;
}
// make frame invisible
this._visible = false;
// Capture stage parameters
var oldMode:String = Stage.scaleMode;
Stage.scaleMode = "exactFit";
var cX:Number = Stage.width/2;
var cY:Number = Stage.height/2;
var sX:Number = Stage.width;
var sY:Number = Stage.height;
Stage.scaleMode = oldMode;
// create color instances for color
// transforms (if any).
var camColor:Color = new Color(this);
var parentColor:Color = new Color(_parent);
// Make the stage move so that the
// v-cam is centered on the
// viewport every frame
this.onEnterFrame = camControl;
// Make an explicit call to the camControl
// function to make sure it also runs on the
// first frame.
camControl();
// If the v-cam is ever removed (unloaded)
// the stage, return the stage to the default
// settings.
this.onUnload = resetStage;

Now, to change the position of everything in the frame, just move the V-cam, this is a great way to reduce lag in games with a large background

To make something stay in the same position, it must be in a movie clip, and have the same center square as the V-cam, and simple add this script to the movieclip

onClipEvent(enterFrame){
_x = _root.Cam._x;
_y = _root.Cam._y;
}


BBS Signature

Response to As: V- Cam 2006-07-01 13:05:04


there is already a link to the ORIGONAL tutorial for the V-Cam in AS: Main. This tutorial is a rip off.


BBS Signature

Response to As: V- Cam 2006-07-01 13:05:37


i couldn't see the original v- cam tutorial in the AS: main list....


BBS Signature

Response to As: V- Cam 2006-07-01 13:06:23


At 7/1/06 01:05 PM, Hoeloe wrote: i couldn't see the original v- cam tutorial in the AS: main list....

hmm. i coulda sworn i seen it there....does not matter, the code is not yours and this hardly qualifys as a tut. It will most likely not be linked in AS: Main.


BBS Signature

Response to As: V- Cam 2006-07-01 13:10:45


At 7/1/06 01:06 PM, Zac_Donald wrote: I heard there was a rotate-able V cam some where, I havent found one yet

That'd be awesome if you could find it.

Response to As: V- Cam 2006-07-11 02:56:49


At 7/1/06 01:10 PM, Splurgle wrote:
At 7/1/06 01:06 PM, Zac_Donald wrote: I heard there was a rotate-able V cam some where, I havent found one yet
That'd be awesome if you could find it.

lol thats just _root._rotation = this._rotation; noobs

Response to As: V- Cam 2006-07-11 03:13:28


i think he meant 3d rotateable... which is unlikely


BBS Signature

Response to As: V- Cam 2006-07-11 08:35:54


This tutorial is a complete copy-paste ripoff.

The exact same code and comments came in with the v-cam *.fla I downloaded somewhere else ages ago.

Response to As: V- Cam 2006-07-11 08:56:18



...

BBS Signature

Response to As: V- Cam 2006-07-11 09:22:37


Ok, if you're classing this as your tutorial, explain the code.

Response to As: V- Cam 2006-07-11 09:39:36


At 7/1/06 01:04 PM, Hoeloe wrote: AS: Main

V-Cams are an extremely useful peice of flash scripting. They are flash cameras that can be used in sidescrolling games instead of moving a large background.

There's not a script called V-Cam.
The V-Cam was made by Sham Bangal using Actionscript. Not the V-Cam actionscript or anything.
So this can't really be made a tutorial about.


BBS Signature

Response to As: V- Cam 2006-07-11 09:45:38


At 7/11/06 09:22 AM, Cybex wrote: Ok, if you're classing this as your tutorial, explain the code.

Couldn't have said it better myself :)


BBS Signature

Response to As: V- Cam 2006-07-11 10:44:32


lol this is just a copy... but anyways, have they made it into a tool yet cause I'd like to look into getting it.

Response to As: V- Cam 2006-07-11 10:57:10


At 7/11/06 10:44 AM, D_to_da_P wrote: lol this is just a copy... but anyways, have they made it into a tool yet cause I'd like to look into getting it.

There is no need to.
Let's be honest, someone in Abobe would have to sit down and say "Hmm. A tool for dynamically changing the size of the stage needs to be created". Then they'd have to ask if this feature was plausible, find a place to slot it into the actual code (possibly incurring the wrath of the Feature Bloat god Creep'Featlu) and announce it as a revolutionary tool - which only a small percentage of it's users (A smattering of Flash animators) would actually use.

It also eats resources like a bitch. It renders the entire scene still, but only focusses on a small part of it, additionally adding even more code for Flash's VM to handle. Sucks the life right out of it if you use it badly...


...

BBS Signature

Response to As: V- Cam 2006-07-11 11:01:22


At 7/11/06 10:57 AM, KaynSlamdyke wrote: It also eats resources like a bitch. It renders the entire scene still, but only focusses on a small part of it, additionally adding even more code for Flash's VM to handle. Sucks the life right out of it if you use it badly...

That's why I like to just move objects across the stage. Seriously, it's a lot easier than people seem to think. The same effect as a camera can pretty much be achieved by putting your animation in a big graphic and tweening that across the stage.


BBS Signature

Response to As: V- Cam 2006-07-11 11:03:12


At 7/11/06 10:57 AM, KaynSlamdyke wrote:
There is no need to.

<img src="http://img123.imageshack.us/img123/57
62/cameratool4wy.jpg" border="0" width="78" alt="Image Hosted by ImageShack.us" />

Were they just pullin my leg then?

Response to As: V- Cam 2006-07-11 11:04:57


double post my bad i messed that link up... here let me see if this works...

As: V- Cam

Response to As: V- Cam 2006-07-11 11:08:09


At 7/11/06 11:04 AM, D_to_da_P wrote: double post my bad i messed that link up... here let me see if this works...

If that's an actual picture (and if so, why the hell would they remove the Rectangle tool?), then I doubt it'd be actual VCam. It might be bitmap caching (taking a "photograph" of a vector, maybe?). Otherwise, I'm guessing this is a sacrafice to Creep'Featlu...


...

BBS Signature

Response to As: V- Cam 2006-07-11 11:57:17


At 7/11/06 11:08 AM, KaynSlamdyke wrote:
At 7/11/06 11:04 AM, D_to_da_P wrote:
If that's an actual picture (and if so, why the hell would they remove the Rectangle tool?), then I doubt it'd be actual VCam. It might be bitmap caching (taking a "photograph" of a vector, maybe?). Otherwise, I'm guessing this is a sacrafice to Creep'Featlu...

no no, theres a way to change around what you have in your tools. Ive seen it down on a little video for a tool they brought out to make walking animations easier... i forget what it was called though.
Go to the link that the one guy gave out to see the page with the V-cam on it, the picture I sent is on that page.

Response to As: V- Cam 2006-07-15 09:12:35


At 7/11/06 11:08 AM, KaynSlamdyke wrote: (and if so, why the hell would they remove the Rectangle tool?)

Lol.

As: V- Cam


BBS Signature