Forum Topic: Actionscript codes here!

(209,879 views • 8,558 replies)

This topic is 286 pages long. [ 1 | 2 | 3 | 4 | 5 | 6 | 7146286 ]

<< < > >>
None

Br00d

Reply To Post Reply & Quote

Posted at: 5/4/03 11:31 PM

Br00d LIGHT LEVEL 06

Sign-Up: 03/13/03

Posts: 77

is there a way to make rain constantly?


None

Hadji-San

Reply To Post Reply & Quote

Posted at: 5/4/03 11:37 PM

Hadji-San EVIL LEVEL 14

Sign-Up: 06/17/02

Posts: 151

yeah ypou have to make a moive background or something if you want it in game...

also in case anyone didnt read my post, on some scripts i really need, here they are again.

if i have random movement on an enemy MC, how would i make it randomly attack when its near me? and whats the command for the random attacking and dying after being hit? like if i hit key down and it hits another MC, make MC die animation. anyone get it? i think you might need to see my .swf to understand it...


Happy

EviLudy

Reply To Post Reply & Quote

Posted at: 5/5/03 06:12 AM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,526

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

None

niger2234

Reply To Post Reply & Quote

Posted at: 5/5/03 06:54 PM

niger2234 EVIL LEVEL 07

Sign-Up: 03/20/03

Posts: 181

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...


None

Cominatcha

Reply To Post Reply & Quote

Posted at: 5/5/03 08:10 PM

Cominatcha LIGHT LEVEL 10

Sign-Up: 02/16/03

Posts: 686

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:)


Happy

EviLudy

Reply To Post Reply & Quote

Posted at: 5/8/03 08:51 AM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,526

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

Swing a Little more!
.. ROCK OUT!

BBS Signature

None

KorteX

Reply To Post Reply & Quote

Posted at: 5/9/03 01:40 PM

KorteX NEUTRAL LEVEL 18

Sign-Up: 01/04/03

Posts: 1,648

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?


Questioning

slimshadyboy888

Reply To Post Reply & Quote

Posted at: 5/9/03 11:38 PM

slimshadyboy888 EVIL LEVEL 05

Sign-Up: 03/28/03

Posts: 16

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??


None

DeimosSaturn

Reply To Post Reply & Quote

Posted at: 5/10/03 01:36 AM

DeimosSaturn NEUTRAL LEVEL 09

Sign-Up: 04/15/03

Posts: 398

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?


None

White-Rhyno

Reply To Post Reply & Quote

Posted at: 5/10/03 04:30 AM

White-Rhyno DARK LEVEL 38

Sign-Up: 04/28/03

Posts: 2,933

how do you drag a layer mask, like the view from a sniper scope?


Happy

EviLudy

Reply To Post Reply & Quote

Posted at: 5/10/03 04:32 AM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,526

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

Happy

EviLudy

Reply To Post Reply & Quote

Posted at: 5/10/03 09:17 AM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,526

Anyone has a nice script for a game 4 me?

Swing a Little more!
.. ROCK OUT!

BBS Signature

None

titbread

Reply To Post Reply & Quote

Posted at: 5/10/03 09:40 AM

titbread LIGHT LEVEL 15

Sign-Up: 12/02/00

Posts: 2,281

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

no

~tit


None

titbread

Reply To Post Reply & Quote

Posted at: 5/10/03 09:51 AM

titbread LIGHT LEVEL 15

Sign-Up: 12/02/00

Posts: 2,281

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

stopAllSounds();

~tit


Questioning

santi

Reply To Post Reply & Quote

Posted at: 5/10/03 01:45 PM

santi EVIL LEVEL 08

Sign-Up: 10/13/02

Posts: 77

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


None

Ambyth

Reply To Post Reply & Quote

Posted at: 5/10/03 01:54 PM

Ambyth NEUTRAL LEVEL 23

Sign-Up: 02/09/03

Posts: 1,795

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)


Happy

Kamasutra

Reply To Post Reply & Quote

Posted at: 5/10/03 06:19 PM

Kamasutra EVIL LEVEL 15

Sign-Up: 03/07/03

Posts: 1,032

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


None

santi

Reply To Post Reply & Quote

Posted at: 5/11/03 11:28 AM

santi EVIL LEVEL 08

Sign-Up: 10/13/02

Posts: 77

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


None

santi

Reply To Post Reply & Quote

Posted at: 5/11/03 11:33 AM

santi EVIL LEVEL 08

Sign-Up: 10/13/02

Posts: 77

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


None

PikaExploder

Reply To Post Reply & Quote

Posted at: 5/12/03 07:49 AM

PikaExploder FAB LEVEL 14

Sign-Up: 04/08/01

Posts: 1,644

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


Shouting

MyStiKKhAoS

Reply To Post Reply & Quote

Posted at: 5/13/03 06:06 PM

MyStiKKhAoS LIGHT LEVEL 10

Sign-Up: 03/14/03

Posts: 327

------
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?


None

ninja-yes

Reply To Post Reply & Quote

Posted at: 5/13/03 07:10 PM

ninja-yes NEUTRAL LEVEL 06

Sign-Up: 04/30/03

Posts: 8

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


None

EviLudy

Reply To Post Reply & Quote

Posted at: 6/18/03 04:28 AM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,526

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

None

titbread

Reply To Post Reply & Quote

Posted at: 6/18/03 06:08 AM

titbread LIGHT LEVEL 15

Sign-Up: 12/02/00

Posts: 2,281

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

kewel, nice one man!

~tit


Angry

y3llow

Reply To Post Reply & Quote

Posted at: 6/18/03 06:12 AM

y3llow EVIL LEVEL 08

Sign-Up: 04/21/03

Posts: 1,274

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.


Happy

AngryAxel

Reply To Post Reply & Quote

Posted at: 6/18/03 06:22 AM

AngryAxel NEUTRAL LEVEL 25

Sign-Up: 11/01/02

Posts: 1,827

this IS a good thread!


Happy

EviLudy

Reply To Post Reply & Quote

Posted at: 6/18/03 06:34 AM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,526

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

None

Idoru

Reply To Post Reply & Quote

Posted at: 6/18/03 08:08 AM

Idoru EVIL LEVEL 02

Sign-Up: 01/11/02

Posts: 689

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.


None

titbread

Reply To Post Reply & Quote

Posted at: 6/18/03 09:43 AM

titbread LIGHT LEVEL 15

Sign-Up: 12/02/00

Posts: 2,281

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


All times are Eastern Standard Time (GMT -5) | Current Time: 06:02 PM

<< Back

This topic is 286 pages long. [ 1 | 2 | 3 | 4 | 5 | 6 | 7146286 ]

<< < > >>
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!