00:00
00:00
Newgrounds Background Image Theme

mihaithecool just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Actionscript codes here!

390,076 Views | 7,981 Replies
New Topic

Response to Actionscript codes here! 2003-05-05 06:12:48


Now I have a problem :D

Can someone tell me how to make somthing throwable by mouse, like in Defend your castle ! (the game that is 56th in the top 50) I need it for a game.

Ps. Keep posting


Swing a Little more!

.. ROCK OUT!

BBS Signature

Response to Actionscript codes here! 2003-05-05 18:54:40


i spent 50 bucs for the flash mx bible and it has liek no actuon script. The people wotn let me return it, and i dont even understand it. Im fucked...

Response to Actionscript codes here! 2003-05-05 20:10:55


haha dude im sorry about the book thing you got ripped off man lol ne ways if ya want as go buy the flashactionscript bible:)

Response to Actionscript codes here! 2003-05-08 08:51:08


For learning things like in this topic, mostly you'll heve to buy ACTIONSCRIPT books.


Swing a Little more!

.. ROCK OUT!

BBS Signature

Response to Actionscript codes here! 2003-05-09 13:40:16


At 5/2/03 05:12 AM, Stormclock wrote: heres is some simple code for ammo in a shooting game:

this was very helpfull but i need 2 more things.
1). if i have a automatic gun (machine gun)how would i make it so when i hold down the button on the mouse to shoot the gun the gun keeps firing?
2). how do i make so when i push a certain button like g it switches guns?

Response to Actionscript codes here! 2003-05-09 23:38:29


I am making a shooter game in which you see only the cross hair. I got it so that the crosshair follows the mouse but i want it to play my gunshot sound when I click. i have this code that doesn't work:
onClipEvent (mouseDown) {
gunSound = new Sound();
gunSound.attachSound("gunshot");
gunSound.start();
}
the "gunshot" is the sound i want to use. can any1 help me??

Response to Actionscript codes here! 2003-05-10 01:36:12


I'm simple. =3
What do you do to make a replay button at the very end of a movie and make it so the movie ends there instead of going back to the beggining? Also, i'm making a movie where there's a lot of tiny details that people might miss, is it possible to allow the viewer to slow down the frame rate and sound (or at least stop it and restart at the time elapsed after the slow motion is stopped) by pressin the space bar or something?

Response to Actionscript codes here! 2003-05-10 04:32:34


Now here's a tutorial for making a atomatic gun:

1) You must make a movieclip, that must be labbeled gun
2) That movieclip must have two frames
3) This code must be in the first frame of the movieclip: stop();
4) The second frame of the movieclip must have the shooting sound and the animation of a shooting gun.
5) Get out of the movieclip and give it this script:
onClipEvent (mouseDown) {
shot += 1;
}
onClipEvent (enterFrame) {
if (shot>0) {
tellTarget ("_root.gun") {
play();
}
}
}
onClipEvent (mouseUp) {
shot=0;
}

6) And last: add this script to your first frame of the movie:shot=0;


Swing a Little more!

.. ROCK OUT!

BBS Signature

Response to Actionscript codes here! 2003-05-10 09:17:28


Anyone has a nice script for a game 4 me?


Swing a Little more!

.. ROCK OUT!

BBS Signature

Response to Actionscript codes here! 2003-05-10 09:40:23


At 5/10/03 09:17 AM, eviLudy wrote: Anyone has a nice script for a game 4 me?

no

~tit

Response to Actionscript codes here! 2003-05-10 09:51:56


At 5/4/03 11:14 PM, Link7 wrote: How do i make a MUTE button?

stopAllSounds();

~tit

Response to Actionscript codes here! 2003-05-10 13:45:56


Hey, please, can somedy tell me a code for doing this:
I have a movie clip that follows the mouse, and I want that when i click, the MC stays on the position that he was and play, what's the code? thanx

Response to Actionscript codes here! 2003-05-10 13:54:32


I'm being a bit of an ass but I must ask:

Does anyone have any idea how to create an oscilloscope (line that goes all wavey when you talk!)
in flash?? It's on Flash MX and it's gotta be actionscript, cos it's part of a netradio
project (running from mp3)

Response to Actionscript codes here! 2003-05-10 18:19:23


umm i really hope some one knows this how can i make a game like megaman..
but what i really need to know is how to make it when he moves foward the rest of the backround moves along.. because im making a game but the only place he can go to is the area where the frame is visible i want him to keep going like the game megaman project x

Response to Actionscript codes here! 2003-05-11 11:28:42


Can somebody help me? I was needing a timer with minutes, seconds and thousandths, can somebody give me the code? THNX!

Response to Actionscript codes here! 2003-05-11 11:33:58


oops! I forgot! Can it make a countdown? thnx!

Response to Actionscript codes here! 2003-05-12 07:49:50


Here's a whole bunch of basic codesfor you to use. I tryed to stay away from the Look at this!! and eviLudy's actionscript, but I just couldn't help adding character movement. Sorry to you guys with Flash 5.
That is yours to keep. Just copy and paste the code into your games/movies.

Note: if you didn't know, the actionscript is in the text... the text is a symbol

Response to Actionscript codes here! 2003-05-12 07:52:21


Response to Actionscript codes here! 2003-05-13 18:06:08


------
About the Video Game Script:
I got the script to make him move around,
but how do I stop him from going into the edges and hitting other objects that I don't want him to?

Response to Actionscript codes here! 2003-05-13 19:10:40


i have 2 questions. One is:
HOW DO U MAKE PPL IN A SHOOTER OR ANYTHING RANDOMLY POPUP?

and the other is:
HOW DO U ADD SOUND TO WHEN U CLICK (as in a gunshot or watever)?

thx

Response to Actionscript codes here! 2003-06-18 04:28:48


Scrolling movement with walls code:
(Game is viewed from top)


onClipEvent (load) {
// Choose a movespeed
moveSpeed = 10;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
if (_root.Walls.hitTest(getBounds(_root).xMax, _y, true)) {
} else {
this._x += moveSpeed;
}
// Move Right
} else if (Key.isDown(Key.UP)) {
if (_root.Walls.hitTest(_x, getBounds(_root).yMin, true)) {
} else {
this._y -= moveSpeed;
}
// Move Up
} else if (Key.isDown(Key.DOWN)) {
if (_root.Walls.hitTest(_x, getBounds(_root).yMax, true)) {
} else {
this._y += moveSpeed;
}
// Move Down
} else if (Key.isDown(Key.LEFT)) {
if (_root.Walls.hitTest(getBounds(_root).xMin, _y, true)) {
} else {
this._x -= moveSpeed;
}
// Move Left
}
}
onClipEvent (enterFrame) {
if (_root.player._x > 500) {
this._x -= 10;
tellTarget ("_root.walls") {
_x -= 10;
}
}
if (_root.player._x < 50) {
this._x += 10;
tellTarget ("_root.walls") {
_x += 10;
}
}
if (_root.player._y > 350) {
this._y -= 10;
tellTarget ("_root.walls") {
_y -= 10;
}
}
if (_root.player._y < 50) {
this._y += 10;
tellTarget ("_root.walls") {
_y += 10;
}
}
}

Keep posting cus this was dead 4 a while.


Swing a Little more!

.. ROCK OUT!

BBS Signature

Response to Actionscript codes here! 2003-06-18 06:08:33


At 6/18/03 04:28 AM, eviLudy wrote: Scrolling movement with walls code:
(Game is viewed from top)

kewel, nice one man!

~tit

Response to Actionscript codes here! 2003-06-18 06:12:54


ok i no this question has been answered in a couple of other threads but none of those answers worked for me, heres the question.

Im tryin to work out how to make the walking animation play in an MC when i press one of the directional buttons.

Heres the code i currently have.

if(Key.isDown(Key.UP)){
gotoAndPlay(2);
}else{
stop();

This code is in the first frame of the MC. is there an error in there? or should i just place it somewhere else and change it a bit?

Plz im really stuck on this one.


BBS Signature

Response to Actionscript codes here! 2003-06-18 06:22:31


this IS a good thread!

Response to Actionscript codes here! 2003-06-18 06:34:46


Awnsering to Y3llow's question:

Ok, here's the plan:
I have made a complete moving system for you.
Make a movieclip, In the first frame you make another movieclip, with an animation he moves
right in the second frame of the first movieclip you put another movieclip where he
moves up in the third frame of the first movieclip you make another movieclip with
the character moving Down And in the 4th frame you make him move left.
Now get back to your scené and put this code into the first movieclip:


onClipEvent (load) {
// Set the move speed
moveSpeed = 10;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this._x += moveSpeed;
this.gotoAndStop(1);
// Move Right
} else if (Key.isDown(Key.UP)) {
this._y -= moveSpeed;
this.gotoAndStop(2);
// Move Up
} else if (Key.isDown(Key.DOWN)) {
this._y += moveSpeed;
this.gotoAndStop(3);
// Move Down
} else if (Key.isDown(Key.LEFT)) {
this._x -= moveSpeed;
this.gotoAndStop(4);
// Move Left
}
}

I hope you get it, if you don't post it and i'll send u a .FLA file.

-Post more!
-View my profile!
~ EviLudy


Swing a Little more!

.. ROCK OUT!

BBS Signature

Response to Actionscript codes here! 2003-06-18 08:08:53


the defend your castle thing isn't hard

the stick figure attacker is just a button embeded into an mc. If it is still on the ground it just runs toward the castle walls until it hits it and runs the attack movieclip

how far you throw it is where it gets a little tricky. let's say that

xvector = _x
yvector = _y

this is placed at the very end of the script, ok? so that the variables xvector and yvector are equal to _x and _y of the attacker. now when you release it, it's _x and _y is going to be different from xvector and yvector because enterframe isn't instantaneous.

therefore:

xdiff = _x - xvector
ydiff = _y - yvector

then all it does is just go through the air with a velocity of xdiff and a velovity of ydiff that's constantly being altered by a falling acceleration.

Response to Actionscript codes here! 2003-06-18 09:43:10


At 5/4/03 11:18 PM, perpetuous_dreamer wrote: Weee!

Actionscripting: My nightmare!

it really isn't that hard, if u can speak another language, then u can easily learn AS, its just commands like play(); would make a movie play and ON (release) {
_root.gotoAndPlay(a frame number);
} placed on a button would make ur movie goto a certain frame and play.

If u wanna learn mo' goto flashkit, and search for tutorials on google.com or u could by colin moock's book actionscript the definative guide

~tit

Response to Actionscript codes here! 2003-06-18 14:13:34


These are some good scripts thanx alot man

Response to Actionscript codes here! 2003-06-18 22:39:03


Im having trouble with this enemey AI progarmming can anyone help me please?

Response to Actionscript codes here! 2003-06-18 22:56:47


this topic is a big ripoff of "look at this"

most of the codes are pretty useless and easy anyway