I Think everyone should find these useful!!!!! Please post if you have any questions or If you have any other good scripts.thx.
Movie Clip Follows Mouse
_________________________________
onClipEvent(enterFrame) {
this._x = _root._xmouse;
this._y = _root._ymouse;
}
*********Dragging Script
_____________________________________
onClipEvent (enterFrame) {
if (drag) {
this._x = _root._xmouse;
this._y = _root._ymouse;
}
}
Runaway from Mouse
__________________________________________
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse,_root._ymouse,true)) {
this._x = int(Math.random()*550);
this._y = int(Math.random()*400);
}
}
Random Appearance
__________________________________________
onClipEvent(load) {
chanceOfAppearing = 10;
chance = 0;
}
onClipEvent(enterFrame) {
chance++;
if (Random(chanceOfAppearing) < chance) {
this._x = Random(550);
this._y = Random(400);
chance = 0;
} else {
this._x = -100;
}
}
Random Wandering
_____________________________________________
onClipEvent(load) {
wanderAmount = 300;
leftLimit = 10;
rightLimit = 540;
chanceOfJump = 50;
xPosition = 275;
speed = 10;
chanceOfChange = 0;
}
onClipEvent(enterFrame) {
xPosition += speed;
this._x = xPosition;
chanceOfChange++;
if ((Math.random()*wanderAmount < chanceOfChange) or (xPosition < leftLimit) or (xPosition > rightLimit)) {
speed = -speed;
chanceOfChange = 0;
}
if (Math.random()*chanceOfJump == 1) {
xPosition = Math.random()*(rightLimit-leftLimit)+leftLimit;
}
}
Random Movement
______________________________________________
onClipEvent(load) {
dx = Math.random()*10-5;
dy = Math.random()*10-5;
}
onClipEvent(enterFrame) {
this._x += dx;
this._y += dy;
if (Math.random() > .9) {
dx = Math.random()*10-5;
dy = Math.random()*10-5;
}
}
Tell Targets
___________________________________
on (release) {
tellTarget ("../bar") {
nextFrame ();
}
}
Replacing Mouse (PLACE SCRIPT IN FRAME NOT IN MOVIE CLIP)
___________________________________________________________
startDrag("_root.cursor", true);
Mouse.hide()
CREATING A MOVING BACKGROUND WITH A MOVIE CLIP
________________________________________________
onClipEvent(enterFrame){
if(_root.character._x > 200){
this._x -= 10
_root.character._x -= 10
}
if(_root.character._x < 100){
this._x += 10
_root.character._x += 10
}
}
SIDE TO SIDE CHARACTER MOVEMENT
___________________________________
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this._x+=5;
} else if (Key.isDown(Key.LEFT)) {
this._x-=5;
}
}
UP and DOWN DIRECTION MOVEMENT FOR A CHARACTER
______________________________________________
onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
this._y-=5;
} else if (Key.isDown(Key.DOWN)) {
this._y+=5;
}
}
FOLLOW MOUSE SCRIPT 2
_____________________________
onClipEvent (load) {
_x = 0;
_y = 0;
speed = 3;
}
onClipEvent (mouseMove) {
targetx = _root._xmouse;
targety = _root._ymouse;
}
onClipEvent (enterFrame) {
_x += (targetx-_x)/speed;
_y += (targety-_y)/speed;
}
Hope some of this was helpful! Spread the knowledge!
~Fargate