00:00
00:00
Newgrounds Background Image Theme

mystlol 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,041 Views | 7,981 Replies
New Topic

Response to Actionscript codes here! 2003-06-23 11:42:02


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

Response to Actionscript codes here! 2003-06-24 00:45:07


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.


BBS Signature

Response to Actionscript codes here! 2003-06-24 04:35:15


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

Response to Actionscript codes here! 2003-06-24 18:25:36


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.

Response to Actionscript codes here! 2003-06-25 08:16:07


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

Response to Actionscript codes here! 2003-06-25 11:10:52


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.

Response to Actionscript codes here! 2003-06-25 12:12:42


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

Response to Actionscript codes here! 2003-06-25 13:05:19


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

Response to Actionscript codes here! 2003-06-25 13:07:02


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

Response to Actionscript codes here! 2003-06-25 16:00:17


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

Response to Actionscript codes here! 2003-06-25 16:30:43


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

Response to Actionscript codes here! 2003-06-25 16:38:57


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?

Response to Actionscript codes here! 2003-06-26 00:30:34


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


BBS Signature

Response to Actionscript codes here! 2003-06-26 02:25:39


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?


Blah Blah Blah..

Response to Actionscript codes here! 2003-06-26 02:39:58


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

Response to Actionscript codes here! 2003-06-26 05:52:13


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.


BBS Signature

Response to Actionscript codes here! 2003-06-26 06:06:51


Don't worry i got it sorted now.


BBS Signature

Response to Actionscript codes here! 2003-06-26 09:54:46


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

Response to Actionscript codes here! 2003-06-26 15:43:01


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


BBS Signature

Response to Actionscript codes here! 2003-06-26 20:39:15


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

Response to Actionscript codes here! 2003-06-26 21:04:45


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

Response to Actionscript codes here! 2003-06-26 21:10:26


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

Response to Actionscript codes here! 2003-06-26 21:35:41


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

Response to Actionscript codes here! 2003-06-26 21:50:21


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

Response to Actionscript codes here! 2003-06-26 22:00:07


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

Response to Actionscript codes here! 2003-06-26 22:07:56


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

Response to Actionscript codes here! 2003-06-27 18:29:43


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.

Response to Actionscript codes here! 2003-06-27 22:48:08


alright to be more specific, an actionscript to play the song i want. eg: i want say, system of a down to be played for the length of the anmation. is there an action script that will set the song in to the animation, and take up less space?


Blah Blah Blah..

Response to Actionscript codes here! 2003-06-27 22:56:43


At 6/27/03 10:48 PM, Openwounds wrote: alright to be more specific, an actionscript to play the song i want. eg: i want say, system of a down to be played for the length of the anmation. is there an action script that will set the song in to the animation, and take up less space?

okay, i still don't quite get what you're asking but i'll answer it to the best of my ability.

To add a song to flash just click on the frame where you want to add it and then open the property inspector and add the song there. Then do you see where it says "sync"? If you want the song to play along "in-time" with the animation, then set it to stream. But if you just want to leave it as more of a background music, then set it to event(the default).

The only way to make a song take up less space is to compress or cut out the stuff you don't want. To compress it just open it in the library and tweak the compression settings a bit. to cut parts of it out just use the basic windows sound recorder.

hope that answers your questions

-Star_Cleaver


I could surely die

If I only had some pie

Club-a-Club Club, son

BBS Signature

Response to Actionscript codes here! 2003-06-28 08:28:43


At 6/27/03 06:29 PM, Okartar wrote: 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.

I use some of that codes in my criminality, so heres a little somthing of a tutorial:

1) make a new movie, and add this code to the first frame:

stop();
gp=100;
buyed=0;

2) then make two buttos, a buy button and a gain money button

3) Add this script to the buy button:

on (release) {
if (_root.gp > 9) {
_root.buyed += 1;
_root.gp -= 10;
}
}

4) Add this script to the gain money buttom:

on (release) {
_root.gp += 50;
}

5) Make 2 dynamic text boxes

6) put as variable names (var) for the dynamic textboxes:

gp

and in the 2nd box:
buyed

Now test and in the first dynamic text box your money is showed, and in the second one the amount of items youve buyed, withe the buy button, you buy 1 item for 10 Gp, and the second button will give you 50 gp for free!

- Keep posting!


Swing a Little more!

.. ROCK OUT!

BBS Signature