Forum Topic: Actionscript codes here!

(209,890 views • 8,558 replies)

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

<< < > >>
None

PikaExploder

Reply To Post Reply & Quote

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

PikaExploder FAB LEVEL 14

Sign-Up: 04/08/01

Posts: 1,644

At 6/20/03 01:21 PM, eviLudy wrote: tellTarget ("_root.play") {
_visible = true;
}

Bah, I still don't get you eviLudy. Great actionscripter, but you should probably drop the tellTarget. You're getting commands all jumbled up. Try making one line of code instead of complicating it and using a tellTarget.

tellTarget ("_root.play") {
_visible = true;
}

Could be changed to:

_root.play._visible = true ;

One line. How hard is that?


None

Idoru

Reply To Post Reply & Quote

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

Idoru EVIL LEVEL 02

Sign-Up: 01/11/02

Posts: 689

while flash 4 syntax is deprecated they both work relatively the same. It's only when the processes reach over 6000+ per second that's when things get quirky. the deprecated flash 4 syntax tell target actually works faster than dot notation. let's say for example, dot notation:

1. go to the store, buy eggs
2. go to the store, buy meat
3. go to the store, buy salad

while tell target

1 go to the store, stay in store.
2. buy eggs
3. buy meat
4. buy salad.

for a computer and humans in general such subtle differences do not really matter. But when it goes on an on for thousands of more processes and loops it's 'comforting' for the flash player to know that it's still in the store. instead of getting annoyed by redundant information.


None

Akula

Reply To Post Reply & Quote

Posted at: 6/20/03 02:16 PM

Akula FAB LEVEL 18

Sign-Up: 04/17/03

Posts: 8,777

At 5/4/03 05:01 AM, eviLudy wrote: Gun Tutorial
________________________________
Then you make an laser dot, wich is the dot the gun aims to automaticly, and also make it a movieclip. Then put this code into the laserdot movieclip:

onClipEvent (enterFrame) {
this._x = _root._xmouse;
this._y = _root._ymouse;
}
onClipEvent (load) {
Mouse.hide();
}

how do make that when i klick with the laserdot i here a gunshot... i already have the gunshot sound in my library


None

EviLudy

Reply To Post Reply & Quote

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

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,526

Sometimes I use telltarget, sometimes i dont. I've learned the thing with telltarget and I knew that one before I bought my AS-book and once I got the book I learned the other way...

Swing a Little more!
.. ROCK OUT!

BBS Signature

None

EviLudy

Reply To Post Reply & Quote

Posted at: 6/20/03 02:23 PM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,526

At 6/20/03 02:16 PM, Russian_Mobster wrote:
At 5/4/03 05:01 AM, eviLudy wrote:
how do make that when i klick with the laserdot i here a gunshot... i already have the gunshot sound in my library

go to the laserdot movieclip, doubleclick on it and add this script to the 1st frame:

stop()

Then make a 2nd frame in that movieclip, the 2nd frame must have exactly the same image, but attach the sound to that frame...

-This will probably be my last post today, because:

You may post up to 4 replies to this topic per hour.

Swing a Little more!
.. ROCK OUT!

BBS Signature

None

EviLudy

Reply To Post Reply & Quote

Posted at: 6/20/03 02:32 PM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,526

looks like i can keep posting!

Hey Russian_Mobster je bent nederlands!

Swing a Little more!
.. ROCK OUT!

BBS Signature

None

Akula

Reply To Post Reply & Quote

Posted at: 6/20/03 02:38 PM

Akula FAB LEVEL 18

Sign-Up: 04/17/03

Posts: 8,777

about the sound thing... it didn't work... you know another way

p.s. You may post up to 4 replies to this topic perhour. don't tell me your going if you live in england at 10 pm to bed...do you?


None

EviLudy

Reply To Post Reply & Quote

Posted at: 6/20/03 04:23 PM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,526

Damn... I never use sound with Actionscript...
Im going to bed now, sorry

Tommorow I'll post another way.

Swing a Little more!
.. ROCK OUT!

BBS Signature

None

EviLudy

Reply To Post Reply & Quote

Posted at: 6/20/03 04:27 PM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,526

At 6/20/03 02:38 PM, Russian_Mobster wrote: about the sound thing... it didn't work... you know another way

p.s. You may post up to 4 replies to this topic perhour. don't tell me your going if you live in england at 10 pm to bed...do you?

Im from holland, just like you.

Swing a Little more!
.. ROCK OUT!

BBS Signature

Questioning

KorteX

Reply To Post Reply & Quote

Posted at: 6/20/03 07:31 PM

KorteX NEUTRAL LEVEL 18

Sign-Up: 01/04/03

Posts: 1,648

hey guys im following up my project:GHOST game and its going to be a shooter, ive got everyhting down but i cant make the enemy go to the death animatin?..when i click on the mouse the shooting animation goes but they dont die, and when i take off the script that shows the shooting animation and i shoot the enemy it goes to the death animation,ive got them both
on (press) {
play();
}
what do i do


None

Inforcer

Reply To Post Reply & Quote

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

Inforcer EVIL LEVEL 07

Sign-Up: 01/23/03

Posts: 40

At 6/18/03 06:12 AM, y3llow wrote: 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.

.

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?

Yeah , THe code is suppose to be on the MC and its suppose to be "this.gotoAndPlat (2);" than it should work.


None

The-Mercenary

Reply To Post Reply & Quote

Posted at: 6/20/03 07:47 PM

The-Mercenary EVIL LEVEL 17

Sign-Up: 01/22/03

Posts: 2,620

At 6/18/03 06:12 AM, y3llow wrote:
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.

Yeah, You shoulod put the code in the MC, then it should work and change it to this.

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


Questioning

The-Mercenary

Reply To Post Reply & Quote

Posted at: 6/20/03 07:56 PM

The-Mercenary EVIL LEVEL 17

Sign-Up: 01/22/03

Posts: 2,620

sorry if I douple posted but, When yall come back from sleeping, can you guys tell me the code for and enemyu that attacks. you know like when you get close to him he comes after you and hits you, maybe just that he comes after you. I know a Bunch o'scripts but damn this one is a puzzle. I would appriciated if anyone could help.


None

y3llow

Reply To Post Reply & Quote

Posted at: 6/21/03 07:49 AM

y3llow EVIL LEVEL 08

Sign-Up: 04/21/03

Posts: 1,274

ok ive got the walking animation problem working.

now im just trying to get the background changing.
Heres wat im doing.

My game is viewed from the top, my guy at the moment can walk left and right. I've already got the code for when he gets to one side of the screen he teleports to the other side. Now my problem comes in here.

Im trying to get it so the background doesn't move, but when he reaches the edge of one it changes to to next background and say if he goes off the left side of the screen, he comes onto the new background on the right side of the screen. Then wen he walks off the right side of the second background he comes into the first background again.

Hope someone can brighten up this situation for me cause the other codes havent worked.


None

EviLudy

Reply To Post Reply & Quote

Posted at: 6/21/03 10:55 AM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,526

At 6/20/03 02:38 PM, Russian_Mobster wrote: about the sound thing... it didn't work... you know another way

I couldn't find a way with actionscript...
(you're the first one that beat me man!) I found some sound things and i tried some things
but they didn't work...

but this should do the trick:

1) Label your mouse pointer/gun aimer "aimer"
2) Double-Click on it and make a second frame
3) In the second frame, put the sound
4) Add this script to the first frame of the movieclip:

stop();

5) Get out of the mousepointer
6) Add this piece of script to the movieclip labelled "aimer:"

onClipEvent (mouseDown) {
tellTarget ("_root.aimer") {
play();
}
}

This MUST work because I tested it.

Swing a Little more!
.. ROCK OUT!

BBS Signature

None

denacioust

Reply To Post Reply & Quote

Posted at: 6/21/03 12:14 PM

denacioust EVIL LEVEL 13

Sign-Up: 12/03/02

Posts: 151

Could sum1 gimme a script like what Tom Fulp uses in Pico 2 to make hime shrink when u press up I've got a script but it doesn't work like he'll shrink to different amounts eache time and THe Psycho Goldfish script doesn't work.

BBS Signature

None

EviLudy

Reply To Post Reply & Quote

Posted at: 6/21/03 12:47 PM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,526

At 6/21/03 07:49 AM, y3llow wrote:
Im trying to get it so the background doesn't move, but when he reaches the edge of one it changes to to next background and say if he goes off the left side of the screen, he comes onto the new background on the right side of the screen. Then wen he walks off the right side of the second background he comes into the first background again.

Hope someone can brighten up this situation for me cause the other codes havent worked.

OK here goes nothing:

1) Make the background a movieclip and label it "background"
2) Make sure the movieclip background is stopped at the first frame
3) Add more backgrounds in the movieclip, you can make as many as you want
4) Add this script to your character (the teleporting must already been done


onClipEvent (enterFrame) {
if (this._x > 550) {
tellTarget ("_root.background") {
nextFrame();
}
}
if (this._x < 0) {
tellTarget ("_root.background") {
prevFrame();
}
}
}

Keep Posting!

-EviLudy

Swing a Little more!
.. ROCK OUT!

BBS Signature

None

EviLudy

Reply To Post Reply & Quote

Posted at: 6/21/03 12:54 PM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,526

At 6/21/03 12:14 PM, denacioust wrote: Could sum1 gimme a script like what Tom Fulp uses in Pico 2 to make hime shrink when u press up I've got a script but it doesn't work like he'll shrink to different amounts eache time and THe Psycho Goldfish script doesn't work.

You mean that when he walks away from you he gets smaller? Thats easy, here you go:

I have made an entire moving script so the script you used for moving the character must be deleted, here's the script:


onClipEvent (load) {
// Set the move speed and the srinking size
moveSpeed = 10;
srinkSize = 2;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
this._x += moveSpeed;
// Move Right
} else if (Key.isDown(Key.UP)) {
this._y -= moveSpeed;
this._height -= srinkSize;
this._width -= srinkSize;
// Move Up
} else if (Key.isDown(Key.DOWN)) {
this._y += moveSpeed;
this._height += srinkSize;
this._width += srinkSize;
// Move Down
} else if (Key.isDown(Key.LEFT)) {
this._x -= moveSpeed;
// Move Left
}
}

Swing a Little more!
.. ROCK OUT!

BBS Signature

None

Cartoonists

Reply To Post Reply & Quote

Posted at: 6/21/03 02:06 PM

Cartoonists EVIL LEVEL 04

Sign-Up: 05/15/03

Posts: 8

How can I make a character with a gun shoting
at enemys and bullets kill theM?


None

denacioust

Reply To Post Reply & Quote

Posted at: 6/21/03 03:53 PM

denacioust EVIL LEVEL 13

Sign-Up: 12/03/02

Posts: 151

thanks but I want it to stop at a certain time

BBS Signature

Happy

Akula

Reply To Post Reply & Quote

Posted at: 6/21/03 03:56 PM

Akula FAB LEVEL 18

Sign-Up: 04/17/03

Posts: 8,777

weet ik ik was alleen ff weg de hele dag


None

PikaExploder

Reply To Post Reply & Quote

Posted at: 6/21/03 04:08 PM

PikaExploder FAB LEVEL 14

Sign-Up: 04/08/01

Posts: 1,644

At 6/20/03 07:31 PM, xtumtumx wrote:

Try this:

on (press){
_root.shootAnimation.gotoAndPlay(#);
_root.deathAnimation.gotoAndPlay(#);

Replace "shootAnimation" with whatever the instance of the shooting animation is, and "deathAnimation" with whatever the instance of the death animation is.

Change "#" to whatever frame the animation starts on.

Are you working on ghost and bot? I suggest working on one before the other. It sucks having 2 or three different projects going on at once.

Good to see you dropping by tumtum.
Show me some of that cool art :)


None

y3llow

Reply To Post Reply & Quote

Posted at: 6/22/03 12:03 AM

y3llow EVIL LEVEL 08

Sign-Up: 04/21/03

Posts: 1,274

At 6/21/03 12:47 PM, eviLudy wrote: OK here goes nothing:

sorry dude but that one didn't work either. wen i tested it he got to the edge and an error popped up and said that it couldnt find the target for tellTarget. does it work with Flash MX?


None

The-Mercenary

Reply To Post Reply & Quote

Posted at: 6/22/03 12:24 AM

The-Mercenary EVIL LEVEL 17

Sign-Up: 01/22/03

Posts: 2,620

Are you guys ignoring me on purpose, cause 2 people already asked about the fighting game(I was 1) and you guy dont seem to be answering, so here it is again,
CAN YOU GUYS GIVE ME THE CODE FOR A ENEMY THAT ATTACK YOU WHEN YOU GET NEAR HIM?
dont ignore me.


None

StarCleaver

Reply To Post Reply & Quote

Posted at: 6/22/03 12:25 AM

StarCleaver LIGHT LEVEL 29

Sign-Up: 01/03/03

Posts: 10,102

At 6/22/03 12:03 AM, y3llow wrote:
At 6/21/03 12:47 PM, eviLudy wrote: OK here goes nothing:
sorry dude but that one didn't work either. wen i tested it he got to the edge and an error popped up and said that it couldnt find the target for tellTarget. does it work with Flash MX?

if you're using MX then you shouldn't be using tellTarget. use dot syntax. Its the new operator so it should be the one you are using. Don't get into the habit of using deprecated methods. And i looked at EvilLudy's script and it looks fine just replace the tellTarget with the dot syntax and it should work.

I could surely die
If I only had some pie
Club-a-Club Club, son

BBS Signature

Happy

StarCleaver

Reply To Post Reply & Quote

Posted at: 6/22/03 12:30 AM

StarCleaver LIGHT LEVEL 29

Sign-Up: 01/03/03

Posts: 10,102

At 6/22/03 12:24 AM, Freek_Sk8er wrote: Are you guys ignoring me on purpose, cause 2 people already asked about the fighting game(I was 1) and you guy dont seem to be answering, so here it is again,
CAN YOU GUYS GIVE ME THE CODE FOR A ENEMY THAT ATTACK YOU WHEN YOU GET NEAR HIM?
dont ignore me.

ummmm, make the code yourself *shrug*

just use some simple logic and i'm sure you'll think of something. just use the position of you enemy and then if your "good guy" is within a certain distance of your enemy, the enemy goes into a "fight" state of some sort. I have faith that you can figure it out from there, cuz i'm tired and am going to bed and i don't want to explain a lot of stuff right now. have fun

-Star_Cleaver

I could surely die
If I only had some pie
Club-a-Club Club, son

BBS Signature

None

y3llow

Reply To Post Reply & Quote

Posted at: 6/22/03 12:33 AM

y3llow EVIL LEVEL 08

Sign-Up: 04/21/03

Posts: 1,274

At 6/22/03 12:25 AM, Star_Cleaver wrote: if you're using MX then you shouldn't be using tellTarget. use dot syntax. Its the new operator so it should be the one you are using. Don't get into the habit of using deprecated methods. And i looked at EvilLudy's script and it looks fine just replace the tellTarget with the dot syntax and it should work.

i thought thats wat i should be doing, i know waht dot syntax is but im not sure of the code. could u plz give me an example of it so i can figure it out.


None

StarCleaver

Reply To Post Reply & Quote

Posted at: 6/22/03 12:41 AM

StarCleaver LIGHT LEVEL 29

Sign-Up: 01/03/03

Posts: 10,102

At 6/22/03 12:33 AM, y3llow wrote: i thought thats wat i should be doing, i know waht dot syntax is but im not sure of the code. could u plz give me an example of it so i can figure it out.

well, tellTarget and dot syntax will do the same things but dot syntax is just the newer, better way to do it. And what do you mean by "im not sure of the code"? and here's an example using ludy's script:

onClipEvent (enterFrame) {
if (this._x > 550) {
_root.background.nextFrame();
trace("Off right side")
}
}
if (this._x < 0) {
_root.background.prevFrame();
trace("Off left side")
}
}
}

i just threw in some trace commands just to make sure that you're reading everything right. you can omit those if you want, i'm just in the habit of putting those in there when doing hitTest and position checks.

I could surely die
If I only had some pie
Club-a-Club Club, son

BBS Signature

None

EviLudy

Reply To Post Reply & Quote

Posted at: 6/22/03 05:07 AM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,526

Im too used to telltarget to drop it completly, but for things like

_x
_y
_visible
enabled

And that stuff, I mostly use dot syntax

Swing a Little more!
.. ROCK OUT!

BBS Signature

Happy

y3llow

Reply To Post Reply & Quote

Posted at: 6/22/03 05:58 AM

y3llow EVIL LEVEL 08

Sign-Up: 04/21/03

Posts: 1,274

thanks for the help, i finally got it goin almost ok. theres still a couple of bugs in the script but ill work them out later.


All times are Eastern Standard Time (GMT -5) | Current Time: 06:21 AM

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