PDA

View Full Version : [AS2] Vcam


PhatKitty
02-20-2009, 04:01 PM
I have a vcam and it's working fine, following my char in my platformer, but the problem is I can't draw anything inside my vcam without removing the "this._visible = false" but this bit is needed. I'm using this as my vcam script:

function camControl() {
var _l4 = sX/this._width;
var _l3 = sY/this._height;
_parent._x = cX-this._x*_l4;
_parent._y = cY-this._y*_l3;
_parent._xscale = 100*_l4;
_parent._yscale = 100*_l3;
}
// End of the function
function resetStage() {
var _l2 = {ra:100, rb:0, ga:100, gb:0, ba:100, bb:0, aa:100, ab:0};
parentColor.setTransform(_l2);
_parent._xscale = 100;
_parent._yscale = 100;
_parent._x = 0;
_parent._y = 0;
}
// End of the function
this._visible = false;
var oldMode = Stage.scaleMode;
Stage.scaleMode = "exactFit";
var cX = Stage.width/2;
var cY = Stage.height/2;
var sX = Stage.width;
var sY = Stage.height;
Stage.scaleMode = oldMode;
var camColor = new Color(this);
var parentColor = new Color(_parent);
this.onEnterFrame = camControl;
this.onUnload = resetStage;
//V-Cam Script

What I want is to have my inventory of 5 weapons always at the top left of the screen, and I figured that would be easiest to put it inside my vcam.

PhatKitty
02-21-2009, 12:23 AM
Since my post in gaming development is slowley getting buryed, I'll post it here in more detail.

I have a Vcam set to follow a stickman, It works fine and all, but there is one problem, I can't draw inside the Vcam, as it doesn't show up unless I remove the "this._visible = false" bit. Can someone tell me if there is something wrong with my vcam, if I need a new one, or if there is any other way to make my ammo icon stay at the top right of the screen?

Any help would be really appreciated.

mattdude
02-21-2009, 01:49 AM
i believe this is generally frowned upon, but if you are going to do this, would you make a convenient link to the other thread so we don't have to go searching? thanks, man :)

PhatKitty
02-21-2009, 02:14 AM
Other thread (http://www.actionscript.org/forums/showthread.php3?t=198061)

And why is it frowned upon? Because there's always a veiwfinder on the ones you download, whats the point in putting it in if theres no way you can see it?

mattdude
02-21-2009, 02:29 AM
lol no i meant posting multiple threads on the same topic. i don't know if that's against the rules here, but most help forums i've been on say you shouldn't post multi post... anyway, i'll take a look, but i'm not promising--there are many people here who are far better at as than i am.

PhatKitty
02-21-2009, 02:37 AM
Sorry mods ^^ and thanks =)

CyanBlue
02-21-2009, 02:50 AM
Thanks for pointing it out, mattdude... Yeah... We don't like to see the crossposts in this forum... Crossposts merged... ;)

I have a dumb question for you... What is a vcam???

PhatKitty
02-21-2009, 02:58 AM
A Vcam is a virtual camera, it's basicly a box that will squeeze the entire screen into it, so if you had a massive map and you put the Vcam over your charecter, and you made the Vcam follow the charecter, you would get a side scrolling game. Does that help a bit?