Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Follow Object Help



Hello I need a script that will make a following object with easing
and with boundaries.....
Trying to make a menu stay on a x_pos but need easing and follow mouse
with speed control ........

Please help i have look every where for it...

mark lane



ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0
Posted on: 02-04-2007, 07:51 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

How Is This Done (Drag Object Anywhere Return To Origin), Object Follow Mouse On Lock
Both on same site,

1/. how did he do the dragable discs to the left of the introduction text?

2/. how did he make it so when you roll over a menu link, an object follows it underneath, but also stays there until you roll over the next?

Thanks

Object In Movieclip Follow Object Outside
Hi

How can I make an object inside a movieclip follow an object outside of the movie clip?

I've tried the following but it doesn't work


Code:
ball.onEnterFrame = function() {
ball.x = control.x;
ball.y = control.y;
}

GETTING An Object To FOLLOW The Other
im making a fighting game..and im trying to get player 2 which is a droid player thats suppose to know about player 1 etc. Im having problems writing the code that allows player2 to know where player one is..and move towards him in a slow enough fashion. I got it to work..kinda..except the way i coded it..it jumps from one point to the location of player1 WAY to quickly. how can i slow it down? any suggestions. heres my code..just for that section.

player1 = player1 x //ignore these 2 variables...
player2 = player2 x //

if(player1 != player2){
p1=player1;//x of player 1
p2=player2;//x of player 2
currentDistance = p1-p2;


//this doesnt work properly..it kinda works..and tracks..to some degree..but increments WAY to fast.
//i want it to know how far player 1 and 2 are from each other and have player 2...and increment by 10 until its x and y, are equal to the x and y of player one

setProperty(this,_rotation,+0);
setProperty(this,_x,(_x + (currentDistance)));




}

If I Want An Object To Follow...
Hello again!!!

I just need some help here.
How can i program this:
-one ball that you should be able to drag,
-small balls that should follow after the bigone,
-the small ones should "float" around a bit, ->
->> when you start dragging it, they should stand still for ca. 0.1 sec and then follow, but when you stop dragging the bigone the smallones should float to theyr posision around the bigone...

Thanks

Follow Object Help
im trying to get one movieclip to follow another one that is animated along a path - this has to be a dynamic function - not keyframed. i've been breaking apart the follow mouse function and so on - but i dont want it random and i dont want it be user-initiated..

thanks

How Do You Get An Object To Follow Another
Ok, this project just keeps throughing me curve balls.

I need to know if it is possible to drag one movie clip while having another movie clip following it around.

Example I have a movie clip of a pen that is dragable and it has two hit points on the stage. The hit points are close together and thanks to the invisible box surronding the pen it hovers over both hit points. Now I would like to creat an invisible movie clip at the tip of the pen that actually activates the hit points but it also has to follow the pen when dragged.

Want Object To Follow Mouse With Lag
I was wondering how I could make an object follow the mouse constrained to a horizontal path. I would like it to lag behind the mouse a little bit to and then go beyond it when the mouse stops, as if to have momentum. I just need someone to poin tme in the right direction.

Making An Object Follow An Other
Hi, this is my first post here so please dont destroy me!

I'm trying to make an interface in which the navigation is moving randomly.

now, i managed to get the randomness of the movement of the objects from a book, but they are created from one MC, meaning that i cant make each one individual.

so what i wanted to do was create a text MC which will be at the same coordinate as the dynamically moving objects.

so if someone could tell me roughly the kind of code i need that would be great.

i apologise if what i'm saying is unclear, its difficult to describe!

How Do You Get An Object To Follow The Mouse?
i know there is probaly a tutorial on this somwhere but i cant find it so how do you get an object to follow the mouse?

any help would be gratly appriciated.

-syadon-

Object Follow Mouse
I'm trying to make an object follow the mouse, to be a targeter, and I already tried the following:

onClipEvent (enterFrame) {
x.position = _xmouse
y.position = _ymouse
}

But it didn't work. What's the actionscript?

Trying To Get An Object To Follow Mouse
Hi, I'm trying to get a circle (eyeball) to follow mouse, I know there's a wat of getting object to follow mouse as I;'ve seen it but not sure how to do it. What i want to dospecifically is ahve the direction or angle of object to swivel in attraction to mouse. Any suggestions?


Many Thanks

Frank

Object Won't Follow Path
Working on Classroom in a Book Flash CS3 Professional (p 77 for those who have it)

I drew a looped path for my rocket to follow, but
my rocket won't follow the path, it just flies from the beginning point to the end point

I checked orient to path, sync and snap

Any ideas?

Object Follow Path
Can anyone help me to figure out how to make an object follow a path. For instance - I want to make a square move on the path of a circle. Thank you.

Stage Follow Object?
I'm having a hard time finding what I'm looking for and it could be because I'm searching the wrong terms. I'm making a timeline where I have a movie clip move along a motion guide. I would like to make it so that the object still follows along the path and instead of moving off the screen, have it be centered on the screen while the camera/screen follows along. Am I making any sense? Any help or guidance would be greatly appreciated.

Thanks!

Duke

How To Get An Object To Follow Your Mouse?
Hello,

On some sites I have noticed that when you roll your mouse over a certain area of a web page that it will follow your mouse where ever the mouse is moved to. Is there some command in action script that is used to acieve this? If so, can you do this in Flash 5 or only in Flash MX?

Thanks, Elrods

How Do I Get An Object To Follow The Mouse Along The X Axis?
Hi All,

I was wondering if anyone could help me ...

Im trying to have an arrow pointing down that follows the mouse along the x axis....however...i only want the arrow to move along this axis whenever the mouse is over a certain part of the stage...

Like the arrow thats used here: http://www.superhere.net/

Can anyone help??

Cheers!!
[Edited by dvdvault on 08-04-2002 at 07:24 AM]

Making An Object Follow Your Mouse
How do I make a object follow my mouse but on a set path. Like I have this graphic I want to follow my mouse only going left and right. Also I made some text effects with swish and I want to have them appear only when you have the mouse over a button. Swish files come in swf files. I can make the file play only in the button up frame. When I put it in the button roll over nothing happens. Hope I explained that right and thanx to whoever can help.

Making An Object Follow A Particular Path
Hey everyone

Does anyone know how to making an object in a movie follow a particular path?

Heres what im trying to do,

I have to globes and I want a spark to orbit round the globes, activly following the lines that i set out
is there anyway i can make this happen?

Object Wont Follow The Guide
I have four objects in four layers, i want them all to follow the same guide line, i made the guide layer and then put all four object layers underneath so that they are affected by it.

i tested the animation, but even before then, when i was moving the objects around to their initial location from their finla location only two of them would "snap" at their center to the guide line, while the other two wont, then when i played the animation only the two whose center snapped would follow the guideline while the other two wouldnt.

and it isnt a matter of layer misplacement, because the first layer does snap, the second doesnt, the third does and the fourth doesnt, then i made a new identical guideline layer and moved both the second and fourth layers underneath it, but even then they wouldnt snap.

what could be happening?

Anybody Know How To Make An Object Follow Set Path?
i think the title speaks for itself, im sure its really simple but there are no tutorials on it that i found and flash help is no.. help..

all i want is my MC to follow a path...

thanks a billion

imitator

[MX04] Auto Follow An Object
Hi All

Been using flash for a while but Actionscript just isnt my strength.

Im trying to make a basic vertical shooter game and i want enemies to auto target your ship. So basically when you move your ship the tank turret or laser bolt things target your ship. (Basically if you hadnt moved it it would hit you)
Ive sort of downloaded some example of it but its all maths and even though im ok at maths i thought where the heck do i start with that.

Firstly does anyone understand my problem
Secondly, does anyone know any SHORTENED versions and easier methods of acheiving this.

Thanks

AceyLi

Mouse Follow But Avoid Object
Hi All,

Can anyone tell me how I can do the following please?

I have a flash 8 (although can use mx/2004 if need be) movie that contains an mc of a boat that follows the mouse around the screen, which looks good and works perfectly.

I now need to include a graphic of an island in the centre of the movie and the boat needs to avoid or bounce off this island if the path to the mouse takes the boat over/through the island.

Can ayone tell me how I can do this please? I was hoping for some code that I could just drop onto both the boat mc and the island mc.

At present all of the boat mc's scrip is contained on the first fram rather than the boat itself.

Any ideas anyone?

Hope you can put me right


D

[F8] Help How Do You Make An Object Follow Mouse Only When...
How do you make an object follow the mouse only when it gets to a certain distance from the object?

i would be everso grateful if somebody could help me out here!

thanks

Sinem

[F8] Help How Do You Make An Object Follow The Mouse Only When...
How do you make an object follow the mouse only when it gets to a certain distance from the object?

i would be everso grateful if somebody could help me out here!

thanks

Sinem

3d Object's Eyes Follow Mouse. HOW?
i wanted my 3d oject of Ironmans face to follow the mouse. just the front of the face so what would i need to use and do.

Make An Object Follow The Mouse
I found an old game I had tried to make, but had trouble with it so I just quit it. I still can't figure out a solution to the problem I had with it, so I'm asking here.
There is a circle movie clip that follows the mouse and when it hits it, it's game over. You have to avoid the object, and every 5 seconds, another comes onto the screen. The problem is, it starts to follow the mouse, but just overlaps the other circle, so it is just like having one circle following the mouse. Here's the code on the circle:


ActionScript Code:
onClipEvent (enterFrame) { // makes the object follow the mouse and rotate to it
        myRadians = Math.atan2 ( _root._ymouse-this._y, _root._xmouse-this._x );
        myDegrees = Math.round ( ( myRadians*180/Math.PI ) );
        _root.yChange = Math.round ( _root._ymouse-this._y );
        _root.xChange = Math.round ( _root._xmouse-this._x );
        _root.yMove = Math.round ( _root.yChange/20 );
        _root.xMove = Math.round ( _root.xChange/20 );
        this._y += _root.yMove;
        this._x += _root.xMove;
        this._rotation = myDegrees+90;
}

And here's the code on the frame:


ActionScript Code:
onEnterFrame = function() {
   
if (enemy1.hitTest(cursor_mc._x, cursor_mc._y) || _root["enemy"+count].hitTest(cursor_mc._x, cursor_mc._y) ) { // tells if the player has been hit
    gotoAndStop ( 4 );
    clearInterval(scoreTimer);
    clearInterval(newEnemy);
    _root["enemy"+count].removeMovieClip();
}
       
}; 

function enemyFunc() { // makes a new enemy every 5 seconds
    enemy1.duplicateMovieClip ( "enemy"+count, -count );
    _root["enemy"+count]._x = spawnPoint._x;
    _root["enemy"+count]._y = spawnPoint._y;
}
newEnemy = setInterval(enemyFunc, 5000);
   
function scoreFunc() { // adds a point to the score every 10 milliseconds
        score++;
}
scoreTimer = setInterval (scoreFunc, 10);

Can someone tell me how I would make the duplicated movieclips follow a different path to the mouse?

Mouse Follow Avoids Object
Hi All,

Can anyone tell me how I can do the following please?

I have a flash 8 (although can use mx/2004 if need be) movie that contains an mc of a boat that follows the mouse around the screen, which looks good and works perfectly.

I now need to include a graphic of an island in the centre of the movie and the boat needs to avoid or bounce off this island if the path to the mouse takes the boat over/through the island.

Can ayone tell me how I can do this please? I was hoping for some code that I could just drop onto both the boat mc and the island mc.

At present all of the boat mc's scrip is contained on the first fram rather than the boat itself.

Any ideas anyone?

Hope you can put me right


D

Multiple Object Mouse Follow
I am having some trouble with a project of mine. Here is the code:
Mouse.hide();
var manArrayX:Array = new Array ();
var manArrayY:Array = new Array ();

attachMovie("Man", "manMouse", 2, {_x:_xmouse, _y:_ymouse});
var mouseListener:Object = new Object();
mouseListener.onMouseMove = function () {
manMouse._x = _xmouse;
manMouse._y = _ymouse;
for (i=0; i<23; i++) {
drawline();
}
}
manMouse.onEnterFrame = function (){
movePopulus();
}
Mouse.addListener(mouseListener);
function drawline () {
line_mc.clear();
this.createEmptyMovieClip("line_mc" + i, 100 + i);
_root["line_mc" + i].lineStyle(2, 0x000000, 25);
//trace(i + "," + _root["man" + i]._x);
if (i != 7) {
_root["line_mc" + i].moveTo(_root["man" + i]._x, _root["man" + i]._y);
_root["line_mc" + i].lineTo(_xmouse, _ymouse);
}
}
//My problem i think
function movePopulus () {
for (i=0; i<23; i++) {
if (i < 8) {
_root["man" + i]._x = (_xmouse-_root["man" + i]._x)/3;
_root["man" + i]._y = (_ymouse-_root["man" + i]._y)/3;
}else {
_root["man" + i]._x = (_xmouse-_root["man" + i]._x)/3;
_root["man" + i]._y = (_ymouse-_root["man" + i]._y)/3;
}
}
}

//Population that surrounds mouse
for (i = 0; i < 8; i++) {
var nDerr:Number = Math.sin(i*(Math.PI/4))*100 + 250;
var nCur:Number = Math.sin(i*(Math.PI/4)+(Math.PI/2))*75 + 250;
//trace ("d" + nDerr);
//trace ("c" + nCur);
attachMovie ("Man", "man" + i, i+3, {_x:nDerr, _y:nCur});
manArrayX.push(_root["man" + i]._x);
manArrayY.push(_root["man" + i]._y);
}
for (i = 0; i < 15; i++) {
var nDerr:Number = Math.sin(i*(Math.PI/7.5))*200 + 250;
var nCur:Number = Math.sin(i*(Math.PI/7.5)+(Math.PI/2))*150 + 250;
//trace ("d" + nDerr);
//trace (i+9);
attachMovie ("Man", "man" + (i+8), i+10, {_x:nDerr, _y:nCur});
/*manArrayX.push(_root["man" + (i+8)]._x);
manArrayY.push(_root["man" + (i+8)]._y);
trace(manArrayX[i]);*/
}


I am trying to have the "man" movie clips that encircle the "manMouse" follow with some delay. I feel like I am close, but can't get the follow to work right. I think the problem is in the movePopulus function, I have simplified it for now. I just need to get that function working properly and I can make them trail in the circle.

Object Follow Mouse And Scoring?
Hi I have been using flash for animation for about four years now but just recently started using actionscript when I started developing video games. I've figure a lot of it out on my own but I have had trouble with to things.

1-How to make one object follow the mouse.
2-How to make a scoring system.

Any help would be greatly appreciated because i am really lost on this one

Object Follow Only On Hotspot Area
Oh my.  Can't believe something I see all the time on websites  could be so troublesome to replicate.  Either that, or I'm just terrible with flash.  The latter. :)

Anyhow, I'm still trying to create this:

http://herosite.net/guide.htm

So far the hover pop was accomplished.  Now I need the text to follow the cursor, but only when it's assigned shape layer is hovered upon.  When I do the 'object follow' in AS, the text follows, but since the script runs as soon as the frame starts the text basically follows anywhere on the stage.  I only want the text to follow as long as it's over the hover/ hot spot area.

I tried bellow but the on (rollOver) appears wrong as the text doesn't follow anymore. Removing it just makes the text follow out of the hot spot area like I mentioned above.

on (rollOver){
peyton_mc.onEnterFrame = function() {
    var xMouse = _root._xmouse;
    var yMouse = _root._ymouse;
    if(Math.abs(xMouse - this._x) < 1) {
        this._x = xMouse;
        this._y = yMouse;
    } else {
        this._x -= (this._x-xMouse) / 10;
        this._y -= (this._y-yMouse) / 10;
    }
}
}

It's amazing how many tutorials you'll find on how to make an object follow, but now many about setting boundaries for this object.  Any help offered will be greatly appreciated.

Thanks

How To Make An Object To Follow My Mouse Pointer?
I have done a cursor in flash but don't know how to make it follow my mouse pointer.

Thanks in advance.

Setting Limit For Object To Follow Mouse
I have a object set up to follow my mouse using this code

onClipEven(enter){

this._x=_root._xmouse;
this._y=_root._ymouse;

}

this works fine I want to limit the area the object can follow. Hope I put that right.

Can someone tell me or point me to a good tutorial

thanks

Draw Line Follow The Moving Object
Hi,

do you guys know how do i draw a line/path follow the moving object?

i use the following code to make the movement of the object, but i want a line to trace its moving path. can anyone help?
movingObj._x=Number(my_x)+Number(xmov);
movingObj._y=Number(my_y)+Number(ymov);



thanks

How To Make An Object Follow The Mouse Pointer And....
Guyz need your help urgently!!!!

Im making a website (in Flash MX).

The idea is: the user goes to the website, on the first page there will be an object (say a ball) that is following the mouse.

Once, the user clicked on a link, the ball should then approach that link (which means it is by itself, not following the mouse anymore), and then this ball becomes a pulldown menu.

Do you think it is possible at all? And if it is, please write HOW in details,
thankyou!

[F8]How Do You Make A Movie Clip Follow A Object?
How do you make a movie clip follow an object? I have no clue.

Scripts For Making Object Follow Cursor?
Hello
I am interested in the effect acheived in the nav. area on http://www.crushed.co.uk
As you move to differnet nav links, the slider on the left follows smoothly,vertically with the cursor.
How would I achieve this?

thanks in advance.
Roh

How To Shoot An Object Follow The Direction Of The Arrow ?
Did any guys know how to move the object follow the arrow direction after i click ?

[F8] Making A Stationary Object Follow The Mouse Cursor
So ive been lookin for a way to make an stationary object follow the mouse from a certain anchor point and ive come close... but havent quite made it there, any suggestions?

Script To Make An Object Follow The Mouse On The X-axis, But With Delay?
Anyone know of a tutorial to create an shape that will follow the mouse on the x-axis but with a little delay.

Like on the subnavigation on this page...
http://data.telephonetics.com/beta/index2.html

thanks

Can You Have Actionscript Direct An Object To Follow A Path On A Motion Guide Layer?
Hey there

I'm kind of new to intense actionscripting.

I was wondering if you can use actionscript to direct an object to follow a path that exists in a motion layer?

Mouse Follow/stopfollow After Mouse Leaves Object (with Ease)
well, i think the title covers me entirely, i would like some help with a script.
The problem is, i have a scene with objects that at first they are static, when the mouse comes in and makes a move-over the scene and some objects,i have assigned multiple collision to the objects, i want when the mouse moves over a object, the object to follow the mouse,while colliding to all other objects and after a while i would like as the mouse moves away, the following to stop and the objects to return to its original spot with ease.

I know that this is a big one, but i would like some help if i could get

Moving The "stage" To Follow An Object
Whenever I look at flash games, this is often something I see done: Depending on the position of the mouse, or a character in screen, the stage appears to "move"; that is, objects on the screen shift left, right, up, or down to allow the player to follow the screen.

However, being fairly new to Flash overall, I look at this and I'm left confused. I don't quite get how it works, or at least I don't know what is needed to do it. I also can't seem to find anything online that explains it well enough for me to just go "Oh! That's how it starts! I think I can make sense of that."

I'm not looking so much for actual code help (Although a snippet or two would be great), but a general idea of where to start.

For anyone who is confused by what I mean here, look at either of the following two:

http://www.newgrounds.com/portal/view/59593

http://www.newgrounds.com/portal/view/429765

As you move around, the entire screen seems to move. The character is centered, and it seems like the rest of the stage "moves". I know it's not really, but it seems that way.

Cursor Follow, Click, Doesn't Follow
Before you read, I am not SOLVING said problem in topic, I WANT this "problem" to happen, but I'm not quite sure how to pull it off.

http://www.thesaladcaper.com/stuff/GameTest2.swf

These are two different MCs and of course just simple cursor actionscript. I want the glow/spiral to stop following when clicked. Also, if you could help out with how to make the tank rotate (or possibly even curve) to it's resting point, that'd be a lot of help, as well! Any and all help will be appreciated!

Making An Object Dissapear Once A Moving Object Makes Contact With It
Hello there,

Im in need of some help. Basically I need a code which will make an object disappear once another moving object hits it (MovieClips controlled by AS)

For example, a bullet comes out of the gun and hits a can which makes the can disappear as soon as the bullet hits it.

Is it something to do with the "intersects" function? I've been trying to solve it all day and cant do it

Please help.

Whats It Called When You Drag An Object And Want The Object To Continue Moving
i am trying to work out how to make a draggable movie clip/button continue to move in the same direction as the drag guides it...hmmmm does this make sense???? what is this function / behaviour called.... i have looked at many many drag tutorials but at present have only managed to find drag and drop type onces with target positions.... also does any one know if it is possible assign multiple drag points.

regards....

Video Object - Call To Load And Listener Object Not Working
i've got a video object within a movieclip who's full path i put in a var called 'video'. here's my code, it appears that the video object is not loading my stream and/or i'm not getting the listener object to work properly... everything does trace out good as far as vars, rtmp address, etc... grrr!!!


Code:
//function to load the stream in the vid object
_global.loadVid=function(vidFile){
trace("this is path to vidObj: "+video);
trace("loadVid function var passed: "+vidFile);
var listenerObject:Object = new Object();
listenerObject.ready=function(eventObject:Object):Void{
//video loaded, do this
video.removeEventListener("ready", listenerObject);
_root.container.vidPanel.gotoAndPlay("tovideo");
trace("video is loaded, proceeding to video play state");
};
video.addEventListener("ready", listenerObject);
var nV:String=rtmpURL+vidFile;
video.load(nV, true);
trace("video: "+rtmpURL+vidFile+" should be loading");
}

=- Follow _Y =-
I have a MC with these actions on it (the mc is called Image_Shift)

onClipEvent (load) {
spaceBetween = 240;
// the space between the beginning of a picture and the beginning of the picture following it
numPics = this._width/spaceBetween;
widthPerPic = (this._width/numPics);
}
onClipEvent (enterFrame) {
if (_root.current != _root.selected) {
point = (_root.current-_root.selected);
xDistTotal = point*widthPerPic;
_root.follow._x += xDistTotal;
_root.current = _root.selected;
}
}
then i have a blank mc called follow with
onClipEvent (enterFrame) {
_root._root.Image_Shift._x+= (this._x-_root._root.Image_Shift._x)/4;
}

Now this has the images shift over 240 pics on the x axis. I want it to shift vertically on the y. How can i mod this to have that work. Ive tried to interchange the _x with _y but no luck

thanks
n

Follow Up
I have a while loop that calls:

_root.box.duplicateMovieClip("boxx"+count, count);

count is incremented so I can set the clip to be retrieved a certain number of times by saying:

count = 1;
while (count<5){
_root.box.duplicateMovieClip("boxx"+count, count);
count += 1;}

My movie clip then opens and has the action:

onClipEvent(load)
{
loadVariables ("getdetails.asp?Record=2", this);
}

I would like to send the increasing value of count to my movie clip that is called so I have something like:

onClipEvent(load)
{
loadVariables ("getdetails.asp?Record="count, this);
}

however this hasn't worked. do I need to use setVariable or something ?

Follow Me...actually Rather Don't
How do you make a movie clip follow your cursor?
Å

Copyright © 2005-08 www.BigResource.com, All rights reserved