Newgrounds.com — Everything, By Everyone.

Checking login status…

USERNAME:

PASSWORD:

Logging in…

Logged in as:
.
Logging out…
Inbox My Account Log Out


Forum Topic: Problem with vcam

(108 views • 10 replies)

This topic is 1 page long.

<< < > >>
None

UknownXL

Reply To Post Reply & Quote

Posted at: 6/6/08 04:35 PM

UknownXL EVIL LEVEL 09

Sign-Up: 05/22/05

Posts: 942

Im having issues with my vcam. I want it so it will fallow the main character and it increase its spd to 7 when he is not in the center. But when "hiro" is in the center I want the spd decreased to 0 so it will have an elastic like look. But what keeps happening is the spd will increase to 7 like usual but when hiro is in the center it will not decrease back to 0. It keeps jerking once it equals 7 and I walk after that.Could someone please help me out? Here is my code. Tell me what you think.

onClipEvent (load) {
this._x = _root.hiro._x;
this._y = _root.hiro._y;
this.spd = 0;
}
onClipEvent (enterFrame) {
if (_root.warp) {
this._x = _root.hiro._x;
this._y = _root.hiro._y;
}
if (this._x<_root.hiro._x) {
this._x += this.spd;
_root.movec = true;
}
if (this._x>_root.hiro._x) {
this._x -= this.spd;
_root.movec = true;
}
if (this._y<_root.hiro._y) {
this._y += this.spd;
_root.movec = true;
}
if (this._y>_root.hiro._y) {
this._y -= this.spd;
_root.movec = true;
}
if(this._x==_root.hiro._x && this._y==_root._y){
_root.movec=false;
}
if(_root.movec && this.spd<7){
spd += .5;
}
if(!_root.movec && this.spd>0){
spd-=.5;
}
if(this.spd>7){
this.spd = 7;
}else if(this.spd<0){
this.spd=0;
}
}


None

UknownXL

Reply To Post Reply & Quote

Posted at: 6/6/08 05:01 PM

UknownXL EVIL LEVEL 09

Sign-Up: 05/22/05

Posts: 942

Someone has got to be able to help me out here. Its shouldnt be to hard of a fix.


None

CARDBOARDBOX3R

Reply To Post Reply & Quote

Posted at: 6/6/08 05:07 PM

CARDBOARDBOX3R LIGHT LEVEL 06

Sign-Up: 03/13/08

Posts: 36

At 6/6/08 05:01 PM, UknownXL wrote: Someone has got to be able to help me out here. Its shouldnt be to hard of a fix.

um...i have no clue what this means but this is whats on the vcam i use and it works.
(by the way its AS2)::

function camControl():Void {
parentColor.setTransform(camColor.getTra nsform());
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;

BBS Signature

None

UknownXL

Reply To Post Reply & Quote

Posted at: 6/6/08 05:10 PM

UknownXL EVIL LEVEL 09

Sign-Up: 05/22/05

Posts: 942

Thats for the camera function. I need my v-cam to fallow my main char "hiro". I want it to have an elastic look. So im increasing the speed gradually to 7 when the _x and _y isnt == and im "wanting" to decrease it (_x and _y) when it is ==. But thanks anyway. Atleast one person tries to help. =)


None

UknownXL

Reply To Post Reply & Quote

Posted at: 6/6/08 05:28 PM

UknownXL EVIL LEVEL 09

Sign-Up: 05/22/05

Posts: 942

Man people use to be able to help you on Newgrounds. What happened to the world. I tried to find a tutorial on this but there doesnt seem to be one. Someone, anyone. Just a moment of your time.


Misunderstood

FU5ION

Reply To Post Reply & Quote

Posted at: 6/6/08 06:03 PM

FU5ION FAB LEVEL 08

Sign-Up: 04/12/08

Posts: 43

This is to make it follow, it doesn't have the elasticity in it, but I just wanted to help lol:

onClipEvent (enterFrame) {
setProperty(this, _x, _root.hiro._x);
setProperty(this, _y, _root.hiro._y);
}

FUSION

BBS Signature

None

TaroNuke

Reply To Post Reply & Quote

Posted at: 6/6/08 06:06 PM

TaroNuke LIGHT LEVEL 16

Sign-Up: 10/05/05

Posts: 122

You know, you don't have to use a V cam.

_root._x = -_root.hiro._x+275
_root._y = -_root.hiro._y+200

works fine.

As for getting HUDs to stick to the screen... You'll figure it out.


None

UknownXL

Reply To Post Reply & Quote

Posted at: 6/6/08 06:22 PM

UknownXL EVIL LEVEL 09

Sign-Up: 05/22/05

Posts: 942

Well I can get it to fallow normally I just want its speed to increase while fallowing and then decrease when it is still. Instead it increases to seven and wont decrease back down.


None

UknownXL

Reply To Post Reply & Quote

Posted at: 6/6/08 07:16 PM

UknownXL EVIL LEVEL 09

Sign-Up: 05/22/05

Posts: 942

Ok ive been at it all day and im wondering, why does no one ever help anymore.? I mean seriously? Back in the day people would be on here trying to help seconds after I posted. There has got to be some sort of explanation to this. Someone please help me out here.


None

UknownXL

Reply To Post Reply & Quote

Posted at: 6/7/08 11:32 AM

UknownXL EVIL LEVEL 09

Sign-Up: 05/22/05

Posts: 942

BUMP!


None

ProfessorFlash

Reply To Post Reply & Quote

Posted at: 6/7/08 12:54 PM

ProfessorFlash DARK LEVEL 18

Sign-Up: 10/06/07

Posts: 560

At 6/6/08 07:16 PM, UknownXL wrote: Ok ive been at it all day and im wondering, why does no one ever help anymore.? I mean seriously? Back in the day people would be on here trying to help seconds after I posted. There has got to be some sort of explanation to this. Someone please help me out here.

It's not that clear what your problem is. I read your description twice, both times I got different idea what's your problem. Chances of people to give a solution that isn't really what you are looking for is too high, that's why I at least can't be bothered to help :P (or maybe I'm just a lazy cunt, meh). It would help a lot more if you posted the swf accompanied with a better description of the problem so we could see for ourselves what the problem is.


All times are Eastern Daylight Time (GMT -4) | Current Time: 11:40 PM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!