Forum Topic: Actionscript codes here!

(209,921 views • 8,558 replies)

This topic is 286 pages long. [ 1 | 24 | 5 | 6 | 7 | 8147286 ]

<< < > >>
None

The-Mercenary

Reply To Post Reply & Quote

Posted at: 6/22/03 10:17 PM

The-Mercenary EVIL LEVEL 17

Sign-Up: 01/22/03

Posts: 2,620

At 6/22/03 09:32 PM, Star_Cleaver wrote: A.

ummmm...try harder *shrug*

well, AS is not easy. What you're wanting to be handed to you on a silver platter is hard work. To make it look good and realisitic will take lots of work. I personally don't want to sit down and try to make s

Ok, I'll try harder, but I almost know all the scripts there is to know to make a good game, altho some dont work, no erors but it still dont work, humm, ok here is a question, I aint sure how to put this so sorry if it dont make sence, See I'm making this sk8ing game, and I got him to jump and do the trucks its just that when he lands, and?or if hes doing a trick when he lands, It doesnt go to the beef animation, this is the code I use

onClipEvent (enterFrame){
if (this.hitTest(_root.ground)
this.skater1.gotoAndPlay(15);}

It should work,

and there is this code I use for the jumping to stop And for the character to go to the frame with him standing still.

if (_root.ground.hitTest(this._x, this._y+20, true)) {
vel_y = 0;
jumping = false;
this.skater.gotoAndStop (1);
}

this one works for stopping the dude from falling (duh) and it works like its suppose to.
but when I modify the code so that when a trick is on it plays the beef animation, it fails to work.

this is the modified code,

if (_root.ground.hitTest(this._x+, this._y+, true)
Vel_y = 0;
jumping = false;
if (this.skater1.trick) {this.skater1.gotoAndPlay (15);}}

now the code failes on making him fall.or beef.
NOTE: when I say this.skater1.trick I know that the "trick" is suppose to equal "true" and I did put it to be "true"

So you got any ideas how I can make it work right.


None

The-Mercenary

Reply To Post Reply & Quote

Posted at: 6/22/03 10:25 PM

The-Mercenary EVIL LEVEL 17

Sign-Up: 01/22/03

Posts: 2,620

sorry I messed up the modified code should be this.

if (_root.ground.hitTest(this._x, this._y+20, true)
vel_y = 0;
jumping = false;
if (this.skater1.trick)
this.skater1.gotoAndPlay (15);}}

oh, and I got a MC inside a MC thats Y its this.instancename.gotoandPlay (15);
and I'm using version 5, so Some of the MX codes might not work.


Questioning

KorteX

Reply To Post Reply & Quote

Posted at: 6/22/03 10:45 PM

KorteX NEUTRAL LEVEL 18

Sign-Up: 01/04/03

Posts: 1,648

i have a question, im makin a shooting game, how do i get the shooting animation,bullet animation, and the enemy getting shot all when i click the mouse? i cant get it to work


None

Akula

Reply To Post Reply & Quote

Posted at: 6/23/03 11:42 AM

Akula FAB LEVEL 18

Sign-Up: 04/17/03

Posts: 8,777

At 6/22/03 03:21 PM, Star_Cleaver wrote:
At 6/22/03 03:13 PM, Russian_Mobster wrote: hey ppl how do i make my character go left when i press left and use the good animation the same for right! plz help i tried another script but that one had errors!
onClipEvent (keyUp) {
_root.walk.gotoAndStop(1);
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_root.walk.play();
_root.walk._x -= 15;
_root.walk._xscale=100
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_root.walk.play();
_root.walk._x += 15;
_root.walk._xscale = -100;
}
}

name yoru MC of your guy walking, "walk" and then inside the MC on frame 1 put a stop() command and then on the last frame of the actual walking animation put

gotoAndPlay(2);

assuming 2 is the first frame of your walking sequence.

hope that helps

-Star_Cleaver

thanks a lot!.first it didn't work but later it worked!!

Note to all newbies: when ppl ask you to name your mc something. they don't mean the name when you convert it to a mc but they mean the instance name wich you can find in the properties window! that was my mistake

Russian_mobster


None

y3llow

Reply To Post Reply & Quote

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

y3llow EVIL LEVEL 08

Sign-Up: 04/21/03

Posts: 1,274

At 6/23/03 11:42 AM, Russian_Mobster wrote: Note to all newbies: when ppl ask you to name your mc something. they don't mean the name when you convert it to a mc but they mean the instance name wich you can find in the properties window! that was my mistake

Russian_mobster

yea ive made that mistake a few times and wondered why it didnt work. but it was also because the script that i wrote was wrong.


None

EviLudy

Reply To Post Reply & Quote

Posted at: 6/24/03 04:35 AM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,526

At 6/22/03 10:45 PM, xtumtumx wrote: i have a question, im makin a shooting game, how do i get the shooting animation,bullet animation, and the enemy getting shot all when i click the mouse? i cant get it to work

Ok xtumtumx, here's a complete shooting tutorial:

1) draw the gun, make it a movieclip and label it "gun"
2) Inside the movieclip, make it stopped at the 1st frame and at the 2nd frame, make a shooting animation
3) Add this script to the movieclip (not a frame)
onClipEvent (mouseUp) {
tellTarget ("_root.gun") {
play();
}
}

4) Draw the laser dot (mouse pointer)(doesn't need to be labelled) and add this script to it:
onClipEvent (load) {
this.startDrag(true);
Mouse.hide();
}
5) Draw your enemy and convert it to BUTTON, the actions of the button should be:
on (release) {
play();
}
6)
Convert the button to a movieclip and make the movieclip stopped at the 1st frame. After the first frame make a dying animation for the guy.

7) DONE

Swing a Little more!
.. ROCK OUT!

BBS Signature

None

KorteX

Reply To Post Reply & Quote

Posted at: 6/24/03 06:25 PM

KorteX NEUTRAL LEVEL 18

Sign-Up: 01/04/03

Posts: 1,648

At 6/24/03 04:35 AM, eviLudy wrote:
At 6/22/03 10:45 PM, xtumtumx wrote: i have a question, im makin a shooting game, how do i get the shooting animation,bullet animation, and the enemy getting shot all when i click the mouse? i cant get it to work
Ok xtumtumx, here's a complete shooting tutorial:

1) draw the gun, make it a movieclip and label it "gun"
2) Inside the movieclip, make it stopped at the 1st frame and at the 2nd frame, make a shooting animation
3) Add this script to the movieclip (not a frame)
onClipEvent (mouseUp) {
tellTarget ("_root.gun") {
play();
}
}
4) Draw the laser dot (mouse pointer)(doesn't need to be labelled) and add this script to it:
onClipEvent (load) {
this.startDrag(true);
Mouse.hide();
}
5) Draw your enemy and convert it to BUTTON, the actions of the button should be:
on (release) {
play();
}
6) Convert the button to a movieclip and make the movieclip stopped at the 1st frame. After the first frame make a dying animation for the guy.

7) DONE

thanx, but i dont want the enemy to be a button, ive got it all fine now, but the only thing is it only plays the shooting animation when i shoot the enemy, it wont play if i like shoot the wall or sumthing...oh well thats good enough.


None

EviLudy

Reply To Post Reply & Quote

Posted at: 6/25/03 08:16 AM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,526

I think im good in game programming, but now I don't have an Idea for a game...

Swing a Little more!
.. ROCK OUT!

BBS Signature

Happy

AngryAxel

Reply To Post Reply & Quote

Posted at: 6/25/03 11:10 AM

AngryAxel NEUTRAL LEVEL 25

Sign-Up: 11/01/02

Posts: 1,827

At 6/25/03 08:16 AM, eviLudy wrote: I think im good in game programming, but now I don't have an Idea for a game...

Hmmm... How about a Damn dirty ape who takes over egypt, and now Nhaazan Mahragabah has to kill him, coz the Damn dirty ape killed Nhaazan's father Fharagoaharamaryanaraman Mahragabah. It would be a shooting game where he was armed with stones, and he has to fights Damn dirty apes ape-minions.


Questioning

Sadoke

Reply To Post Reply & Quote

Posted at: 6/25/03 12:12 PM

Sadoke LIGHT LEVEL 14

Sign-Up: 04/14/03

Posts: 190

Can you pls help me with my animating, i'm very bad, and i really want to make something really cool, can you pls help me ? thnx (btw are you dutch ???)


None

EviLudy

Reply To Post Reply & Quote

Posted at: 6/25/03 01:05 PM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,526

At 6/25/03 12:12 PM, Dr_Lo wrote: Can you pls help me with my animating, i'm very bad, and i really want to make something really cool, can you pls help me ? thnx (btw are you dutch ???)

I might be able to help u animating, but im not too good at it.
Yes I'm dutch

Swing a Little more!
.. ROCK OUT!

BBS Signature

None

EviLudy

Reply To Post Reply & Quote

Posted at: 6/25/03 01:07 PM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,526

At 6/25/03 11:10 AM, axeltheman wrote: Hmmm... How about a Damn dirty ape who takes over egypt, and now ...

I already got myself an Idea now.

Swing a Little more!
.. ROCK OUT!

BBS Signature

None

Sadoke

Reply To Post Reply & Quote

Posted at: 6/25/03 04:00 PM

Sadoke LIGHT LEVEL 14

Sign-Up: 04/14/03

Posts: 190

At 6/25/03 01:05 PM, eviLudy wrote: I might be able to help u animating, but im not too good at it.
Yes I'm dutch

Can i add you to my msn ???


None

EviLudy

Reply To Post Reply & Quote

Posted at: 6/25/03 04:30 PM

EviLudy LIGHT LEVEL 39

Sign-Up: 08/17/02

Posts: 4,526

At 6/25/03 04:00 PM, Dr_Lo wrote:
Can i add you to my msn ???

sure, why not. You didn't have to ask.

Swing a Little more!
.. ROCK OUT!

BBS Signature

None

AngryAxel

Reply To Post Reply & Quote

Posted at: 6/25/03 04:38 PM

AngryAxel NEUTRAL LEVEL 25

Sign-Up: 11/01/02

Posts: 1,827

At 6/25/03 01:07 PM, eviLudy wrote:
At 6/25/03 11:10 AM, axeltheman wrote: Hmmm... How about a Damn dirty ape who takes over egypt, and now ...
I already got myself an Idea now.

You realized that I was kidding, right?


Happy

y3llow

Reply To Post Reply & Quote

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

y3llow EVIL LEVEL 08

Sign-Up: 04/21/03

Posts: 1,274

At 6/25/03 04:38 PM, axeltheman wrote:
At 6/25/03 01:07 PM, eviLudy wrote:
At 6/25/03 11:10 AM, axeltheman wrote: Hmmm... How about a Damn dirty ape who takes over egypt, and now ...
I already got myself an Idea now.
You realized that I was kidding, right?

dude thats a pretty dam good idea. i reckon with a bit of tweaking it could make a good game, but keep the dudes really long name thats the funniest thing in there!!!!!!!


Questioning

Openwounds

Reply To Post Reply & Quote

Posted at: 6/26/03 02:25 AM

Openwounds EVIL LEVEL 14

Sign-Up: 12/14/02

Posts: 546

i havent read through this topic because it would take too long... but is there an action script to set a background music? and if there is would it lower the file size?


None

13O2

Reply To Post Reply & Quote

Posted at: 6/26/03 02:39 AM

13O2 NEUTRAL LEVEL 03

Sign-Up: 05/13/03

Posts: 58

adding on to what he said, how do i loop a an mp3 i put into the movie?


Angry

y3llow

Reply To Post Reply & Quote

Posted at: 6/26/03 05:52 AM

y3llow EVIL LEVEL 08

Sign-Up: 04/21/03

Posts: 1,274

Hmmm, well i got a quick question.
How do i put a link to my profile in my sig?
I know pretty much no javascript which im assuming your meant to use(or am i wrong). I've been trying for a few days and haven't got it yert so plz someone solve my problem.


None

y3llow

Reply To Post Reply & Quote

Posted at: 6/26/03 06:06 AM

y3llow EVIL LEVEL 08

Sign-Up: 04/21/03

Posts: 1,274

Don't worry i got it sorted now.


None

AngryAxel

Reply To Post Reply & Quote

Posted at: 6/26/03 09:54 AM

AngryAxel NEUTRAL LEVEL 25

Sign-Up: 11/01/02

Posts: 1,827

At 6/26/03 12:30 AM, y3llow wrote:
dude thats a pretty dam good idea. i reckon with a bit of tweaking it could make a good game, but keep the dudes really long name thats the funniest thing in there!!!!!!!

Wow, you really think that it would be a good idea? Maybe, maybe not...


None

denacioust

Reply To Post Reply & Quote

Posted at: 6/26/03 03:43 PM

denacioust EVIL LEVEL 13

Sign-Up: 12/03/02

Posts: 151

Could sum1 help me I want to know how to throw something and make them come back and hit the ground

BBS Signature

Happy

StarCleaver

Reply To Post Reply & Quote

Posted at: 6/26/03 08:39 PM

StarCleaver LIGHT LEVEL 29

Sign-Up: 01/03/03

Posts: 10,102

At 6/26/03 02:25 AM, Openwounds wrote: i havent read through this topic because it would take too long... but is there an action script to set a background music? and if there is would it lower the file size?

what do you mean by "set a background music"? Do you mean have the user be able to select music? Please be a bit more specific.

At 6/26/03 02:39 AM, 13O2 wrote: adding on to what he said, how do i loop a an mp3 i put into the movie?

Just add the MP3 to the timeline by selecting the keyframe you want the music to start on, then select your music from the drop-down menu in the property inspector. Then just set the loops value. The loops value should be right below where you select the music.

At 6/26/03 03:43 PM, denacioust wrote:

Could sum1 help me I want to know how to throw something and make them come back and hit the ground

So you want something to be able to be picked up and thrown across the screen and then have the thing come back down? Look back a couple pages(i think its this topic) and find a script written by CollegeGuy, it should do what you want, if not you can tweak it a bit, no? If you can't find it in this topic then just use the BBS search tool and just search for CollegeGuy's posts.

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

BBS Signature

None

Grimshot

Reply To Post Reply & Quote

Posted at: 6/26/03 09:04 PM

Grimshot NEUTRAL LEVEL 06

Sign-Up: 02/10/03

Posts: 31

i'm curious how to make a character, who faces whatever direction its moving... can anyone help?


Happy

StarCleaver

Reply To Post Reply & Quote

Posted at: 6/26/03 09:10 PM

StarCleaver LIGHT LEVEL 29

Sign-Up: 01/03/03

Posts: 10,102

At 6/26/03 09:04 PM, Grimshot wrote: i'm curious how to make a character, who faces whatever direction its moving... can anyone help?

well, if you already know how to make a character move then just use this._xscale=-100 to flip him over when he's walking the opposite direction. But for going up and down you'll just have to draw him facing backwards and then forwards.

If you don't know how to make a character move with AS and need some help, check out The Flash FAQ, in it is explained how to do such a thing.

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

BBS Signature

None

Grimshot

Reply To Post Reply & Quote

Posted at: 6/26/03 09:35 PM

Grimshot NEUTRAL LEVEL 06

Sign-Up: 02/10/03

Posts: 31

i don't know how to make a character move, and that tutorial had a load of errors when i put it in... like "clip event permitted only for move clips" or some shit... i also need the image to be animated when moving, but still when not


Happy

StarCleaver

Reply To Post Reply & Quote

Posted at: 6/26/03 09:50 PM

StarCleaver LIGHT LEVEL 29

Sign-Up: 01/03/03

Posts: 10,102

At 6/26/03 09:35 PM, Grimshot wrote: i don't know how to make a character move, and that tutorial had a load of errors when i put it in... like "clip event permitted only for move clips" or some shit... i also need the image to be animated when moving, but still when not

well, that error occured because you put the codes on the frame not the MC, or that is the most likely explanation. And just use some common sense. I already answered this question you are asking:

At 6/22/03 03:21 PM, Star_Cleaver wrote:

At 6/22/03 03:13 PM, Russian_Mobster wrote: hey ppl how do i make my character go left when i press left and use the good animation the same for right! plz help i tried another script but that one had errors!

onClipEvent (keyUp) {
_root.walk.gotoAndStop(1);
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_root.walk.play();
_root.walk._x -= 15;
_root.walk._xscale=100
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_root.walk.play();
_root.walk._x += 15;
_root.walk._xscale = -100;
}
}

name yoru MC of your guy walking, "walk" and then inside the MC on frame 1 put a stop() command and then on the last frame of the actual walking animation put

gotoAndPlay(2);

assuming 2 is the first frame of your walking sequence.

hope that helps

-Star_Cleaver

See?

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

BBS Signature

None

Grimshot

Reply To Post Reply & Quote

Posted at: 6/26/03 10:00 PM

Grimshot NEUTRAL LEVEL 06

Sign-Up: 02/10/03

Posts: 31

i put the code in the first frame of the movie clip... where the fuck am i supposed to put it... you people forget that when people ask for shit like this they're trying to fucking learn... learning (believe it or not) means having shit explained a little, not just fucking done for you.
sorry i'm irratably right now, i'm not meaning to be a dick.
fuck it... i'm never gonna pick up on actionscript or flash... i've been trying since i got the shit and made the stupid ass Pointless Violence shit... i'll just stick to being a spectator like always


Happy

StarCleaver

Reply To Post Reply & Quote

Posted at: 6/26/03 10:07 PM

StarCleaver LIGHT LEVEL 29

Sign-Up: 01/03/03

Posts: 10,102

At 6/26/03 10:00 PM, Grimshot wrote: i put the code in the first frame of the movie clip... where the fuck am i supposed to put it... you people forget that when people ask for shit like this they're trying to fucking learn... learning (believe it or not) means having shit explained a little, not just fucking done for you.

Well, sorry i didn't know you were that new to flash. To put an action on an MC just click on the MC and open the actions panel, then add the script. If you want some explanations add me to AIM or msn, i'll be glad to help more. The reason i keep it simple and to the point is because people ask these questions everyday and re-typing the answers gets old real fast. Also, if you haven't already, i suggest doing the tutorials that come with flash, they are very helpful.

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

BBS Signature

None

Okartar

Reply To Post Reply & Quote

Posted at: 6/27/03 06:29 PM

Okartar EVIL LEVEL 02

Sign-Up: 05/21/03

Posts: 10

how do you make a money code that you lose money when you buy something and gain it when you well gain money.I also want the money to be called gp.


All times are Eastern Standard Time (GMT -5) | Current Time: 12:34 PM

<< Back

This topic is 286 pages long. [ 1 | 24 | 5 | 6 | 7 | 8147286 ]

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