Forum Topic: Actionscript codes here!

(210,183 views • 8,558 replies)

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

<< < > >>
None

Headmine

Reply To Post Reply & Quote

Posted at: 6/18/03 02:13 PM

Headmine EVIL LEVEL 11

Sign-Up: 04/14/03

Posts: 622

These are some good scripts thanx alot man


None

NinFoxwoods

Reply To Post Reply & Quote

Posted at: 6/18/03 10:39 PM

NinFoxwoods NEUTRAL LEVEL 12

Sign-Up: 08/31/02

Posts: 178

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


None

ChocolateChipClock

Reply To Post Reply & Quote

Posted at: 6/18/03 10:56 PM

ChocolateChipClock NEUTRAL LEVEL 19

Sign-Up: 08/16/02

Posts: 4,127

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

most of the codes are pretty useless and easy anyway


None

y3llow

Reply To Post Reply & Quote

Posted at: 6/19/03 12:13 AM

y3llow EVIL LEVEL 08

Sign-Up: 04/21/03

Posts: 1,274

At 6/18/03 06:34 AM, eviLudy wrote: Awnsering to Y3llow's question:

im doing it by looking down on the character, s all of the movement cycles will be the same. the movement code ive used makes him walk and change dirextions and turn when u press an arrow key. ill try that code but would there be a simpler one that would just make the walking cycle go, and could it be a different script in a different MC?


None

ChocolateChipClock

Reply To Post Reply & Quote

Posted at: 6/19/03 02:03 AM

ChocolateChipClock NEUTRAL LEVEL 19

Sign-Up: 08/16/02

Posts: 4,127

At 6/18/03 10:39 PM, NinFoxwoods wrote: Im having trouble with this enemey AI progarmming can anyone help me please?

it really depends what type of AI you need. you can have easy AI or hard AI. i dont think i can do hard AI. but the easy AI would be to make it so they enemies bounce off walls and go in a certain direction or just have it go in a set direction.


None

Idoru

Reply To Post Reply & Quote

Posted at: 6/19/03 09:57 AM

Idoru EVIL LEVEL 02

Sign-Up: 01/11/02

Posts: 689

At 6/19/03 02:03 AM, ChocolateChipClock wrote:

:-

talk the talk but no walk the walk.


Questioning

Sub7Ecstacy

Reply To Post Reply & Quote

Posted at: 6/19/03 11:22 AM

Sub7Ecstacy LIGHT LEVEL 04

Sign-Up: 05/01/03

Posts: 15

I tried the jump AS and everything worked except for when my character lands on the ground. Basically the character goes right threw the ground MC. I named the MC ground like instructions said. How do i make the ground stop the guy?


Happy

EviLudy

Reply To Post Reply & Quote

Posted at: 6/19/03 12:56 PM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,527

go to the propperties of the ground, and tick in the textbox "label" ground.

That should do the trick, you dont have to name it ground, as long as you label it ground, because the label it the name the actionscript uses.

Swing a Little more!
.. ROCK OUT!

BBS Signature

None

ChocolateChipClock

Reply To Post Reply & Quote

Posted at: 6/19/03 02:04 PM

ChocolateChipClock NEUTRAL LEVEL 19

Sign-Up: 08/16/02

Posts: 4,127

At 6/19/03 09:57 AM, Idoru wrote:
At 6/19/03 02:03 AM, ChocolateChipClock wrote: -
talk the talk but no walk the walk.

which reply were you quoting?


None

Sub7Ecstacy

Reply To Post Reply & Quote

Posted at: 6/19/03 02:17 PM

Sub7Ecstacy LIGHT LEVEL 04

Sign-Up: 05/01/03

Posts: 15

thanx, i got it now. Also now that i got that down, i set the jump to 50 to make my guy jump faster, but he jumps way to high and dont dissapers out of the scene, how could i make a roof to stop him from jumping out of the scene?


Happy

EviLudy

Reply To Post Reply & Quote

Posted at: 6/19/03 02:45 PM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,527

At 6/19/03 02:17 PM, Sub7Ecstacy wrote: thanx, i got it now. Also now that i got that down, i set the jump to 50 to make my guy jump faster, but he jumps way to high and dont dissapers out of the scene, how could i make a roof to stop him from jumping out of the scene?

How high he jumps is part of the variable you set to 50, so the lower that is, the lower the charater jumps. I do have a roof script for you.

1. Draw the roof and convert it to a movieclip
2. LABEL that movieclip "roof"
3. Add this code to the bottem of the script in your character, whre the rest of the jumping script also is:


onClipEvent (enterFrame) {
if (_root.roof.hitTest(this._x, this._y-50, true)) {
grav_y = -20;
}
}

Happy now?

Swing a Little more!
.. ROCK OUT!

BBS Signature

None

NinFoxwoods

Reply To Post Reply & Quote

Posted at: 6/19/03 03:46 PM

NinFoxwoods NEUTRAL LEVEL 12

Sign-Up: 08/31/02

Posts: 178

The AI I want is that it follows the character intill a certian point and then shoots. Thats basically it thanks ahead of time.


None

FenixFlashFilms

Reply To Post Reply & Quote

Posted at: 6/19/03 05:59 PM

FenixFlashFilms NEUTRAL LEVEL 02

Sign-Up: 04/17/02

Posts: 6

can someone tell me the code that plays a frame when all the enemies are shot?

for example look at this
Example of a Shooter

Can u tell me the code that enables the GriffinRUN to pop up after like 3 enemies were shot?


None

Sub7Ecstacy

Reply To Post Reply & Quote

Posted at: 6/19/03 06:57 PM

Sub7Ecstacy LIGHT LEVEL 04

Sign-Up: 05/01/03

Posts: 15

I have a sequence of frames in a MC of my character walking. The onlytime i want the MC of him walking to play is when someone controls him with the left or right keys. Can anyone help me?


None

Idoru

Reply To Post Reply & Quote

Posted at: 6/19/03 08:34 PM

Idoru EVIL LEVEL 02

Sign-Up: 01/11/02

Posts: 689

At 6/19/03 05:59 PM, FenixFlashFilms wrote: can someone tell me the code that plays a frame when all the enemies are shot?

for example look at this
Example of a Shooter

Can u tell me the code that enables the GriffinRUN to pop up after like 3 enemies were shot?

basically whenever a character dies killcount increases by 1 and if killcount reaches, in this case, 3 it goes and plays. It's all very simple. This is my shooter (I didn't add in enemies) :

http://www.thegeekhost.com/asclepeos/cam.swf


None

FenixFlashFilms

Reply To Post Reply & Quote

Posted at: 6/19/03 08:38 PM

FenixFlashFilms NEUTRAL LEVEL 02

Sign-Up: 04/17/02

Posts: 6

can u tell me the codes then.. like the code i would put onto the movie clip of every enemy and the last code to go to a certain frame??


None

Idoru

Reply To Post Reply & Quote

Posted at: 6/19/03 09:51 PM

Idoru EVIL LEVEL 02

Sign-Up: 01/11/02

Posts: 689

I'm reluctant to just give out scripts. I deprive people of the learning experience. It's relatively simple. I'm sure you can figure it out if you just try and read some tutorials on basics of variables. If you still do'nt know then I'll post the code.


None

y3llow

Reply To Post Reply & Quote

Posted at: 6/20/03 12:16 AM

y3llow EVIL LEVEL 08

Sign-Up: 04/21/03

Posts: 1,274

At 6/19/03 06:57 PM, Sub7Ecstacy wrote: I have a sequence of frames in a MC of my character walking. The onlytime i want the MC of him walking to play is when someone controls him with the left or right keys. Can anyone help me?

thats wat i was wanting to do b4. heres the code i used.

first inside the MC of your person make an MC or the person walking left in frame 2, an MC of the person walking right in frame 3 and a person standing still in frame 1. then add this code to the MC.

onClipEvnet(enterFrame){
//Move Left
if(Key.isDown(Key.LEFT)){
gotoAndStop(2);
//Move Right
}else if(Key.isDown(Key.RIGHT)){
gotoAndStop(3);
//Standing Still
}else if(!Key.isDown(Key.LEFT)){
gotoAndStop(1);
}else if(!Key.isDown(Key.RIGHT)){
gotoAndStop(1);
}
}

that should do the trick. it worked for me.

Now i need some help (sorry if this is getting annoying but im learning heaps).

ive got my guy to teleport to the oposite side of the screen wen he reaches the edge, now all i need is for the Background MC to go to the next frame wen he reaches an edge, can anyonw be of any help on this problem?


None

PikaExploder

Reply To Post Reply & Quote

Posted at: 6/20/03 01:06 AM

PikaExploder FAB LEVEL 14

Sign-Up: 04/08/01

Posts: 1,644

At 6/20/03 12:16 AM, y3llow wrote:

Basically, just use the same script you have for when he teleports, but have a gotoAndPlay/gotoAndStop/nextFrame script.

if(this._x >= #){
_root.instanceName.nextFrame();
}


None

y3llow

Reply To Post Reply & Quote

Posted at: 6/20/03 01:16 AM

y3llow EVIL LEVEL 08

Sign-Up: 04/21/03

Posts: 1,274

At 6/20/03 01:06 AM, PikaExploder wrote:
At 6/20/03 12:16 AM, y3llow wrote:
Basically, just use the same script you have for when he teleports, but have a gotoAndPlay/gotoAndStop/nextFrame script.

if(this._x >= #){
_root.instanceName.nextFrame();
}

thx man, ive been triing to do it that way for a while but i couldnt get the coding right.

that should do the trick.


Happy

EviLudy

Reply To Post Reply & Quote

Posted at: 6/20/03 05:40 AM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,527

At 6/19/03 05:59 PM, FenixFlashFilms wrote: can someone tell me the code that plays a frame when all the enemies are shot?

for example look at this
Example of a Shooter

Can u tell me the code that enables the GriffinRUN to pop up after like 3 enemies were shot?

I think the terrorists are a movieclip, right? now, in the dying animation, you put a script, this one:

_root.kills += 1

(put that script in all dying-animations)
And that put this script in your mousepointer (the gun aimer wich is a movieclip too I guess)

onClipEvent (enterFrame) {
if (_root.kills > 2) {
getURL("http://www.griffinrun.com");
_root.kills=0;
}
}

And at last, but this script in the first frame of the movie:

kills=0

-Hope that helped!

Swing a Little more!
.. ROCK OUT!

BBS Signature

None

EviLudy

Reply To Post Reply & Quote

Posted at: 6/20/03 05:59 AM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,527

At 6/20/03 12:16 AM, y3llow wrote:
At 6/19/03 06:57 PM, Sub7Ecstacy wrote: I have a sequence of frames in a MC of my character walking. The onlytime i want the MC of him walking to play is when someone controls him with the left or right keys. Can anyone help me?
thats wat i was wanting to do b4. heres the code i used.

first inside the MC of your person make an MC or the person walking left in frame 2, an MC of the person walking right in frame 3 and a person standing still in frame 1. then add this code to the MC.

onClipEvnet(enterFrame){
//Move Left
if(Key.isDown(Key.LEFT)){
gotoAndStop(2);
//Move Right
}else if(Key.isDown(Key.RIGHT)){
gotoAndStop(3);
//Standing Still
}else if(!Key.isDown(Key.LEFT)){
gotoAndStop(1);
}else if(!Key.isDown(Key.RIGHT)){
gotoAndStop(1);
}
}

that should do the trick. it worked for me.

Now i need some help (sorry if this is getting annoying but im learning heaps).

ive got my guy to teleport to the oposite side of the screen wen he reaches the edge, now all i need is for the Background MC to go to the next frame wen he reaches an edge, can anyonw be of any help on this problem?

Well, if you want him to telaport, you use this code:
onClipEvent (enterFrame) {
if (this._x > 550.0) {
this._x = 0;
}
if (this._x < 0) {
this._x = 550.0;
}
if (this._y > 400) {
this._y = 0;
}
if (this._y < 0) {
this._y = 400;
}
}
NOTE: HE WILL TELEPORT AT EVERY EDGE OF THE SCREEN!

To make the background diffrent (next frame) you first must label the background "background" and change the code I just told you into this:
onClipEvent (enterFrame) {
if (this._x > 550.0) {
this._x = 0;
tellTarget ("_root.background") {
nextFrame();
}
}
if (this._x < 0) {
this._x = 550.0;
tellTarget ("_root.background") {
nextFrame();
}
}
if (this._y > 400) {
this._y = 0;
tellTarget ("_root.background") {
nextFrame();
}
}
if (this._y < 0) {
this._y = 400;
tellTarget ("_root.background") {
nextFrame();
}
}
}

Or if you already have an teleport system, add this to your code:
tellTarget ("_root.background") {
nextFrame();
}

Hope that helped

Swing a Little more!
.. ROCK OUT!

BBS Signature

None

y3llow

Reply To Post Reply & Quote

Posted at: 6/20/03 06:30 AM

y3llow EVIL LEVEL 08

Sign-Up: 04/21/03

Posts: 1,274

At 6/20/03 05:59 AM, eviLudy wrote:

yea thats the exact same teleport code i used i think.

and that tellTarget command was the exact one i was looking for, i was sure u could do it but wasnt sure of the code.

Anyways im gonna experiment but what does everyone think:

Should i make the game so when u reach the edge of the screen the next background comes up?

Or should i just make it a continously moving background where it moven when the person moves?

P.S. The game is viewed from above so your looking down on everything.


Happy

EviLudy

Reply To Post Reply & Quote

Posted at: 6/20/03 06:57 AM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,527

I think a diffrent background is the best

Swing a Little more!
.. ROCK OUT!

BBS Signature

None

y3llow

Reply To Post Reply & Quote

Posted at: 6/20/03 07:38 AM

y3llow EVIL LEVEL 08

Sign-Up: 04/21/03

Posts: 1,274

At 6/20/03 06:57 AM, eviLudy wrote: I think a diffrent background is the best

ill make both and put them on the net for everyone to check out and post on


None

ImpotentBoy2

Reply To Post Reply & Quote

Posted at: 6/20/03 11:13 AM

ImpotentBoy2 LIGHT LEVEL 18

Sign-Up: 04/01/03

Posts: 5,318

At 5/2/03 03:02 AM, eviLudy wrote: I just got myself a book Flash MX actionscript ans i've learned a lot already. So i'll post some codes. You should post too!

half those are samples. which is what i did to learn too so what can i say

Some times my "L" key decides not to work.


Happy

Akula

Reply To Post Reply & Quote

Posted at: 6/20/03 11:26 AM

Akula FAB LEVEL 18

Sign-Up: 04/17/03

Posts: 8,776

At 5/10/03 01:36 AM, DeimosSaturn wrote: 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?

in the frame where you want it to stop klick right>actions and if you have mx you go to actions> movie control and you double click the commando stop(in normal mode or just type in expert mode

stop();
------------------------------------------------------
to make a replay button

draw your button and convert it into a symbol with the instance of a button then right click on the button>actions and if you have flash mx go to actions>movie control>play and type in the scene number and frame number(this is normal mode) or type in expert mode

on (release) {
gotoAndPlay("type here scene number", type here frame number);

example to go to scene 1 frame 1:

on (release) {
gotoAndPlay("Scene 1", 1);


None

Akula

Reply To Post Reply & Quote

Posted at: 6/20/03 12:46 PM

Akula FAB LEVEL 18

Sign-Up: 04/17/03

Posts: 8,776

can someone plz tell me the instructions and the as code to make a percentage bar preloader


None

PikaExploder

Reply To Post Reply & Quote

Posted at: 6/20/03 12:49 PM

PikaExploder FAB LEVEL 14

Sign-Up: 04/08/01

Posts: 1,644

At 6/20/03 06:30 AM, y3llow wrote: and that tellTarget command was the exact one i was looking for, i was sure u could do it but wasnt sure of the code.

Don't get too attached to the tellTarget command. It's uses are limited, and it is deprecated. I don't know why eviLudy is using a tellTarget with a _root command. Use _root commands and dot syntax next time.

_root.background.nextFrame()


None

EviLudy

Reply To Post Reply & Quote

Posted at: 6/20/03 01:21 PM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,527

At 6/20/03 12:46 PM, Russian_Mobster wrote: can someone plz tell me the instructions and the as code to make a percentage bar preloader

-You can always take the bar from the NG preloader And here's a tutorial for a percentage:

1) Make a dynamic text box (no text in it) and give it the variable: _root.percent
2) Make a movieclip of that textbox
3) Add this script to your movieclip:

onClipEvent (enterFrame) {
b_loaded = _root.getBytesLoaded();
b_total = _root.getBytesTotal();
percent = Math.round((b_loaded/b_total)*100);
}

This will work if you have used the NG loader also, if you dont use the NG loader, then you also have to do this:
4) Draw a play button
5) Label it: "play"
6) Also add this script to the movieclip that contains your dynamic text box:
onClipEvent (load) {
tellTarget ("_root.play") {
_visible = false;
}
}
onClipEvent (enterFrame) {
if (_root.percent>=100) {
tellTarget ("_root.play") {
_visible = true;
}
}
}

That should do the trick

Swing a Little more!
.. ROCK OUT!

BBS Signature

All times are Eastern Standard Time (GMT -5) | Current Time: 09:57 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!