Look at this!!!!
- Fargate
-
Fargate
- Member since: Oct. 30, 2002
- Offline.
-
- Forum Stats
- Member
- Level 09
- Blank Slate
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
- ChocolateChipClock
-
ChocolateChipClock
- Member since: Aug. 16, 2002
- Offline.
-
- Forum Stats
- Member
- Level 19
- Blank Slate
wow! thank u! i was wondering how to do random stuff. i hope it works when i try it!
- Wormtail
-
Wormtail
- Member since: Apr. 1, 2001
- Offline.
-
- Forum Stats
- Member
- Level 13
- Blank Slate
:: Car script ::
onClipEvent (enterFrame) {
// right
if (Key.isDown(Key.RIGHT)) {
_rotation = _rotation+move;
}
// left
if (Key.isDown(Key.LEFT)) {
_rotation = _rotation-move;
}
// up
if (Key.isDown(Key.UP)) {
if (move<8) {
move++;
}
} else if (move>0) {
move--;
}
// down
if (Key.isDown(Key.DOWN)) {
if (move>-10) {
move--;
}
} else if (move<0) {
move++;
}
// enter
if (Key.isDown(Key.ENTER)) {
_x = 200;
_y = 200;
_rotation = 0;
move = 0;
}
// _x & _y position
if (_rotation>180) {
_y = _y+(move*Math.cos(Math.PI/180*_rotation));
_x = _x-(move*Math.sin(Math.PI/180*_rotation));
}
if (_rotation<180) {
_y = _y-(move*Math.cos(Math.PI/180*_rotation));
_x = _x+(move*Math.sin(Math.PI/180*_rotation));
}
}
- ChocolateChipClock
-
ChocolateChipClock
- Member since: Aug. 16, 2002
- Offline.
-
- Forum Stats
- Member
- Level 19
- Blank Slate
hey, one question, how do u make it so u can give something the effect that it jumps and then comes back down when u release.
- Fargate
-
Fargate
- Member since: Oct. 30, 2002
- Offline.
-
- Forum Stats
- Member
- Level 09
- Blank Slate
You mean making a character jump? A jumping script.
onClipEvent (load){
vel_y = 0;
jumping = false;
}
onClipEvent ( enterFrame){
if (Key.isDown(Key.SPACE) && !jumping) {
vel_y =20;jumping = true;}
if (jumping == true) {
vel_y -=1;
if ( vel_y <=-10){ vel_y=-10;}
this._y -= vel_y;}
if (_root.ground.hitTest (this._x,this._y+45,true))
{vel_y = 0; jumping = false;}
}
Put this code in your character MC. And don't forget to make an MC and LABEL it ground. then place it below your character.(This MC will stop your character when he falls back down).
vel_y =20;jumping = true;}
This line of code determines how high your character will jump. Fiddle with the number if you like.
I hope this has answered your question, if not please post here again! :)
~Fargate
- Fargate
-
Fargate
- Member since: Oct. 30, 2002
- Offline.
-
- Forum Stats
- Member
- Level 09
- Blank Slate
This thread seems to be dying out! What's up with that! Please post more guys. I'm happy to answer any questions I can.
- jjb2004
-
jjb2004
- Member since: Jun. 2, 2001
- Offline.
-
- Forum Stats
- Member
- Level 15
- Blank Slate
im trying to make one of those retarded space fighter games, i got it so i can fire, move, have enemies and everything, but i cant get the enemys to fire back? do you know how? :-p
- Mr-Y
-
Mr-Y
- Member since: Apr. 28, 2000
- Offline.
-
- Forum Stats
- Member
- Level 38
- Blank Slate
Good job guys, this is pure gold to many people... more FLASH PROS should join this BBS noteposting sessions! Wow, this might really come in handy to so many people... many n00bs for FLASH. Keep up the good work! I wish that I could help posting up actionscripts, but I memorized only the basics, and I can't find the flash file I had that has all the cool actionscripts I know!! DAMN.
- Wormtail
-
Wormtail
- Member since: Apr. 1, 2001
- Offline.
-
- Forum Stats
- Member
- Level 13
- Blank Slate
- kickass8227
-
kickass8227
- Member since: Nov. 28, 2002
- Offline.
-
- Forum Stats
- Member
- Level 04
- Blank Slate
yeah i have one question...how the hell do u guys do these things??? thats pretty good
- Mr-Y
-
Mr-Y
- Member since: Apr. 28, 2000
- Offline.
-
- Forum Stats
- Member
- Level 38
- Blank Slate
"Look at this!!!" is a pretty attractive topic name, but it should've been more specific, like "Add and Collect Actionscripts" or something, so the NewGrounds users know that when they come here, they're gonna find valuable things, instead of thinking that this topic is only about looking at dumb pics, and not stopping here.
I posted another message here, right now, just to keep the topic alive.
- Fargate
-
Fargate
- Member since: Oct. 30, 2002
- Offline.
-
- Forum Stats
- Member
- Level 09
- Blank Slate
At 12/6/02 07:55 AM, Mr_Y wrote: "Look at this!!!" is a pretty attractive topic name, but it should've been more specific, like "Add and Collect Actionscripts" or something, so the NewGrounds users know that when they come here, they're gonna find valuable things, instead of thinking that this topic is only about looking at dumb pics, and not stopping here.
I posted another message here, right now, just to keep the topic alive.
Yeah I know, when I made it I didn't think it was going to be so popular. Oh well, the number of replies on the topic might attract people anyways...
- Fargate
-
Fargate
- Member since: Oct. 30, 2002
- Offline.
-
- Forum Stats
- Member
- Level 09
- Blank Slate
By the way here are some updated corrections and More handy scripts.
Dragging Script(CORRECTED, THE ONE IN FIRST POST IS WRONG!!!!!!!!)
_____________________________________
onClipEvent(mouseDown) {
if(this.hitTest(_root._xmouse, _root._ymouse)) {
this.startDrag(true);
}
}
onClipEvent(mouseUp) {
this.stopDrag();
}
jumping Character Script ( PLACE SCRIPT IN CHARACTER MC)
* Don't forget to name Mc called ground if using exact script!!!!
_____________________________________________________________________
onClipEvent (load){
vel_y = 0;
jumping = false;
}
onClipEvent ( enterFrame){
if (Key.isDown(Key.SPACE) && !jumping) {
vel_y =20;jumping = true;}
if (jumping == true) {
vel_y -=1;
if ( vel_y <=-10){ vel_y=-10;}
this._y -= vel_y;}
if (_root.ground.hitTest (this._x,this._y+45,true))
{vel_y = 0; jumping = false;}
}
Racing Game Script ( Place in Racing Car MC)
___________________________________________________________________
onClipEvent (enterFrame) {
// right
if (Key.isDown(Key.RIGHT)) {
_rotation = _rotation+move;
}
// left
if (Key.isDown(Key.LEFT)) {
_rotation = _rotation-move;
}
// up
if (Key.isDown(Key.UP)) {
if (move<8) {
move++;
}
} else if (move>0) {
move--;
}
// down
if (Key.isDown(Key.DOWN)) {
if (move>-10) {
move--;
}
} else if (move<0) {
move++;
}
// enter
if (Key.isDown(Key.ENTER)) {
_x = 200;
_y = 200;
_rotation = 0;
move = 0;
}
// _x & _y position
if (_rotation>180) {
_y = _y+(move*Math.cos(Math.PI/180*_rotation));
_x = _x-(move*Math.sin(Math.PI/180*_rotation));
}
if (_rotation<180) {
_y = _y-(move*Math.cos(Math.PI/180*_rotation));
_x = _x+(move*Math.sin(Math.PI/180*_rotation));
}
}
~Fargate
Keep Adding More!!!!!
- ibanezrocks
-
ibanezrocks
- Member since: Jul. 23, 2002
- Offline.
-
- Forum Stats
- Member
- Level 07
- Blank Slate
WOW MAN!!! ur one good scripter i give u props but lets see if u know this one becuase i dont!lol ne wayz im making a fighting game where there will b all the diff symbols from diff macromedia products like flash,fireworks,dreamweaver u know and they will each there own perosality but i have no idea how to it when u punch it takes away his health and the same when he punches if u could get the scripts thad b the koolest!!!!or mayb do u wanna team with me and work on it(not expectin u will or ne thing jus threw the chance out for the hell of it)ps.im a good animater
- DANNYESLOCO
-
DANNYESLOCO
- Member since: Dec. 1, 2002
- Offline.
-
- Forum Stats
- Member
- Level 18
- Blank Slate
Im reading some book on actionscripting and ive probably read it over 3 times the past year and i have absoleteley no idea how people can become use to this? How long did it take you guys to learn actionscript?
- Fargate
-
Fargate
- Member since: Oct. 30, 2002
- Offline.
-
- Forum Stats
- Member
- Level 09
- Blank Slate
At 12/6/02 03:49 PM, ibanezrocks wrote: WOW MAN!!! ur one good scripter i give u props but lets see if u know this one becuase i dont!lol ne wayz im making a fighting game where there will b all the diff symbols from diff macromedia products like flash,fireworks,dreamweaver u know and they will each there own perosality but i have no idea how to it when u punch it takes away his health and the same when he punches if u could get the scripts thad b the koolest!!!!or mayb do u wanna team with me and work on it(not expectin u will or ne thing jus threw the chance out for the hell of it)ps.im a good animater
First of All do you know how use Tell targets and Hittest? If not there is some serious explaining in order. Just a general note, when you guys post stuff be exact about what exactly you know or don't know.thx.
~Fargate
- BazzMann
-
BazzMann
- Member since: Jun. 8, 2002
- Offline.
-
- Forum Stats
- Member
- Level 17
- Blank Slate
Hey Fargate, firstly you are a thanks for the help so far... im a pretty good designer, but need help for a few things
Okay, basically I know about telling targets, but its a specific hittest idea im not sure of. Actually, 3 problems needing 3 scripts... sorry :(
#1: I have designed a game, where a movieclip in the shape of a basic 'maze' outline is on top, and a character is in between. On a hittest that touches one of the first MC 'walls', ive got it to stop moving, as in not passin through a wall. Thats fine... but how can i get it so you can back away from the wall afterwards? I did it so that
if (wallconflict=1){
onKeyPress(up/down/left/right/orwhatever)
getProperty(movie1, _x)+10
}else{
codeiwrote for nothing to happen
}
Sorry about the coding, its makeshift for wot i actually wrote and it worked... but say if you do collide with a wall, i dont just want it to stop dead, i want you to b able to back away from it again!! Help!
#2: Multi-hit tests! lets say for example, we have 'x' number of movieclips, and you want to test individual/group collisions with one object, lets say a human-controlled clip... how do you do it without multiple hittests? is there some sort of loop?
#3: Duplicating movie clips... ive designed something where a tween shooting a 'bullet' is duplicated on key press, and i used a code that creates one (or many) duplicates on a keypress (i.e. machinegun fire). How do i get these individual DUPLICATES of the movie to have a hit-test, as in react to an object they hit? I used a 'depth' script, so you have a counter called x' that goes up 1 when each is duplicated, and names the duplicate ("movieclip" add x). Conflicts for these?
Thank you so much if you can give me any amount of help/scrpts for any, or all, of these problems! to see some of my pretty okayish animation, check my profile.. dont worry, i wont use ur scripts to make useles example junk cluttering the portal! cheers again, and im sorry for takin so much time and space! but ive got several very good projects planned!
- ibanezrocks
-
ibanezrocks
- Member since: Jul. 23, 2002
- Offline.
-
- Forum Stats
- Member
- Level 07
- Blank Slate
At 12/6/02 05:52 PM, Fargate wrote:At 12/6/02 03:49 PM, ibanezrocks wrote:
First of All do you know how use Tell targets and Hittest? If not there is some serious explaining in order. Just a general note, when you guys post stuff be exact about what exactly you know or don't know.thx.
~Fargate
ya i no hittest and telltraget fine.its almost required to mkae ne thing good in flash nowadays
ya im confortable with hittest u need to do no it to b able to make ne thing that ppl will like on NG
- kickass8227
-
kickass8227
- Member since: Nov. 28, 2002
- Offline.
-
- Forum Stats
- Member
- Level 04
- Blank Slate
hey thanx a lot u guys have been a big help for me, keep making more because u guys are very good
- Spardadmc
-
Spardadmc
- Member since: Dec. 5, 2002
- Offline.
-
- Forum Stats
- Member
- Level 04
- Blank Slate
- Cypher
-
Cypher
- Member since: Nov. 12, 2002
- Offline.
-
- Forum Stats
- Member
- Level 22
- Blank Slate
Wow this has been really helpful to me...maybe now I can make some 'decent' movies.
Thanks a lot Fargate, you must be working up something really good for NG.
:)
Anyhow. I shall make a movie now..I shall ask if I need anything.
~Refkinson
- Fargate
-
Fargate
- Member since: Oct. 30, 2002
- Offline.
-
- Forum Stats
- Member
- Level 09
- Blank Slate
At 12/6/02 11:46 PM, Refkinson wrote: Wow this has been really helpful to me...maybe now I can make some 'decent' movies.
Thanks a lot Fargate, you must be working up something really good for NG.
)Anyhow. I shall make a movie now..I shall ask if I need anything.
~Refkinson
haha. I wish I was making a good movie.I've tried.I may be an intermediate scripter, but my graphics are the dumps. If I could only master Freehand 10. Then I could make something decent. Mind you, I've learned a lot since my last attempt. Ah well, Practice, Practice.
- ibanezrocks
-
ibanezrocks
- Member since: Jul. 23, 2002
- Offline.
-
- Forum Stats
- Member
- Level 07
- Blank Slate
fargate lets team up and make a game u said ur graphics were the dumps but ur a kikc ass scripter im a good grapihc artist well think about it and get bac to me thanxs
- Fargate
-
Fargate
- Member since: Oct. 30, 2002
- Offline.
-
- Forum Stats
- Member
- Level 09
- Blank Slate
At 12/7/02 10:26 AM, ibanezrocks wrote: fargate lets team up and make a game u said ur graphics were the dumps but ur a kikc ass scripter im a good grapihc artist well think about it and get bac to me thanxs
Ok First of all, I looked at your only submission. No offense or anything,but I'd say my graphics are about as good as that( Not that I mean to say your graphics are crap).So.. what would the point be... I don't want to offend you or anything, don't get me wrong.
- ibanezrocks
-
ibanezrocks
- Member since: Jul. 23, 2002
- Offline.
-
- Forum Stats
- Member
- Level 07
- Blank Slate
ya i no that suxs i pumped it out in about a hour i would have more stuff on newgrounds but im not the best scripter i can make racing games 1st person shooters and simple platform but turly i can draw amazing things if u have or a email i could show u some things and i swear u will b amazed
- FFfan06
-
FFfan06
- Member since: Oct. 5, 2002
- Offline.
-
- Forum Stats
- Member
- Level 05
- Blank Slate
I know what action scripts are but how do you use them?
- EviLudy
-
EviLudy
- Member since: Aug. 17, 2002
- Offline.
-
- Forum Stats
- Member
- Level 39
- Blank Slate
You actionscript guys rule! Last half year i only studied a bit with my books html 4.01 but now i see how great you guys are... TOMMOROW I BUY I BOOK FLASH ACTIONSCRIPT!
- Wormtail
-
Wormtail
- Member since: Apr. 1, 2001
- Offline.
-
- Forum Stats
- Member
- Level 13
- Blank Slate
At 12/8/02 09:33 AM, eviLudy wrote: You actionscript guys rule! Last half year i only studied a bit with my books html 4.01 but now i see how great you guys are... TOMMOROW I BUY I BOOK FLASH ACTIONSCRIPT!
YAY!
- Fargate
-
Fargate
- Member since: Oct. 30, 2002
- Offline.
-
- Forum Stats
- Member
- Level 09
- Blank Slate
Damn the number of posts in this thread is sky rocketing!!!! :) :)
- Wormtail
-
Wormtail
- Member since: Apr. 1, 2001
- Offline.
-
- Forum Stats
- Member
- Level 13
- Blank Slate

