00:00
00:00
Newgrounds Background Image Theme

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

393,064 Views | 7,981 Replies
New Topic

Response to Actionscript codes here! 2004-04-02 11:03:48


If your object doesnt move, one reason for that maybe because you havnt specified which direction to move, like an _x += speed variable or something


- Sig provided by ME of the NGSM

- If you try to stay high, your bound to stay low. -

- If I make you a sig, please credit me here -

BBS Signature

Response to Actionscript codes here! 2004-04-02 11:06:23


At 4/1/04 06:49 PM, lordkabita wrote: Ok, so I am working on the passwords part and I created a variable called pass and each time the password is correct, "pass" is set to 1, 2, 3, 4, 5, or 6 depending on what password it is. Now the only problem is that, how do I change a movie clip into a button and give it actions by using the variable "pass"? Is it possible? CAN ANYONE HELP ME!?

If you make your button, then convert the button to a movieclip, voila you have a nested button nested inside a movieclip and then on the Movieclip you can now use both button actions and movie clip actions like:

onClipEvent (load){
trigger = false;
}
on (release){
trigger = true;
}


- Sig provided by ME of the NGSM

- If you try to stay high, your bound to stay low. -

- If I make you a sig, please credit me here -

BBS Signature

Response to Actionscript codes here! 2004-04-02 11:16:25


I made a "charge meter" and I just thought that I would share it with you all:
1)Use the rectangel tool and make a rectangle
2)select the fill inside the rectangle and convert it to a movieclip, and have the registration point on the left
3)in the MC add this:
//Sets up some variables for later use
onClipEvent (load) {
this._xscale = 0;
charged = false;
charging = false;
empty = true;
}
//If you hold space, and it isnt charged, it will increase
onClipEvent (enterFrame) {
if (Key.isDown(Key.SPACE)) {
if (charged == false) {
this._xscale += 1;
charging = true;
empty = false;
}
}
//If the red bars _x gets to 0, the meter is empty
if (this._xscale<=0) {
empty = true;
}
//If the red bar is at the end, the bar is charged
if (this._xscale>=100) {
charged = true;
}
//if your not charging, and the bar is empty, then the bar decreases
if (charging == false) {
if (empty == false) {
if (charged == false) {
this._xscale -= 1;
}
}
}
}
//If it isnt full, and your not holding space, it isnt charging
onClipEvent (keyUp) {
charging = false;
}
//If it is full, and you hit CONTROL, the bar empties
onClipEvent (enterFrame) {
if (Key.isDown(Key.CONTROL) && charged == true) {
empty = true;
this._xscale = 0;
charged = false;
charging = false;
}
}

And thats all there is to it....


- Sig provided by ME of the NGSM

- If you try to stay high, your bound to stay low. -

- If I make you a sig, please credit me here -

BBS Signature

Response to Actionscript codes here! 2004-04-02 12:18:53


At 4/2/04 11:16 AM, Shatter_star wrote: A whole lot of bullshit

Nice script dude


Swing a Little more!

.. ROCK OUT!

BBS Signature

Response to Actionscript codes here! 2004-04-02 14:15:45


hi.
i'm making a side scroller platform game.
i can make my character move left and right okay.
the character is a movieclip and in one of it's frames is a movieclip with an animation of the character swinging his sword.

i have the code
if (Key.isDown(65)){
gotoAndStop("attack");
}

but he only swings his sword while the key is held down. how can I make it so that you only need to tap A to make him attack?

Response to Actionscript codes here! 2004-04-02 15:00:06


um...no. In fact it did nothing at all.

What exactly do you mean "the last fame he's laying the sword"? In the animation he swings his sword and the last frame the sword is farthest away from his body. Does that make a difference?

Response to Actionscript codes here! 2004-04-02 17:48:59


At 4/2/04 11:06 AM, Shatter_star wrote: If you make your button, then convert the button to a movieclip, voila you have a nested button nested inside a movieclip and then on the Movieclip you can now use both button...

Yeah, I figured that out, but how do I switch one MC to another MC trough the use of variables?

Response to Actionscript codes here! 2004-04-02 19:14:29


At 4/2/04 11:03 AM, Shatter_star wrote: If your object doesnt move, one reason for that maybe because you havnt specified which direction to move, like an _x += speed variable or something

yah, now I saw what the hell I did, tnx
now
onClipEvent(enterFrame){
this._x = pspeed
...


wibble wabble

BBS Signature

Response to Actionscript codes here! 2004-04-02 19:24:38


At 4/2/04 07:14 PM, syko227 wrote:
At 4/2/04 11:03 AM, Shatter_star wrote: If your object doesnt move, one reason for that maybe because you havnt specified which direction to move, like an _x += speed variable or something
yah, now I saw what the hell I did, tnx
now
onClipEvent(enterFrame){
this._x = pspeed
...

forget what I said, now I saw that I did all, including _x/y values:
onClipEvent (load){
speed = 0
}
onClipEvent(keyDown){
thisKey = Key.getCode();
if ((lastKey == Key.LEFT || thisKey == Key.RIGHT) && lastKey == Key.RIGHT && thisKey == Key.LEFT){
speed += 0.600000
}
getTimer()
lastKey = thisKey;
trace("lastkey="+lastKey)
}
onClipEvent(enterFrame){
this._y = this._y - speed
}
still doesn't work


wibble wabble

BBS Signature

Response to Actionscript codes here! 2004-04-02 21:56:43


wuz. I was wondering if anybody know how to make a button and when you click it plays a certain animation. Also how do you make more than one and still have a animation wit them.

Response to Actionscript codes here! 2004-04-02 22:06:04


Sooo untrue. You do not need to make a movie clip named walls. You can always say:

if (this._x>=Stage.width) {
this._x = Stage.width;
}
if (this._x<=0) {
this._x = 0;
}
if (this._y>=Stage.height) {
this._y = Stage.height;
}
if (this._y<=0) {
this._y = 0;
}

Response to Actionscript codes here! 2004-04-02 22:09:18


YOU DO NOT NEED TO PUT:

if(condition==false)

You can always say:

if(!condition)

THE ! SIGN MEANS 'NOT'!!!!!!! YOU NEED ACTIONSCRIPT HELP!!!!

Response to Actionscript codes here! 2004-04-03 04:37:32


At 4/2/04 03:13 PM, Amish wrote: No i mean the last frame of him swinging the sword. And also why have u got

gotoAndStap

when it shoudl be

gotoAndPlay

i have a movieclip containing the animation of him swinging his sword. this movieclip is on a frame labelled "attack" inside the player movieclip. so it goes

PlayerMC >> AttackMC >> Attack animation

GotoAndPlay doesn't work

I know it's ironic since i'm asking the question but how hard can it be to make an animation play when a key is tapped?

Response to Actionscript codes here! 2004-04-03 10:04:03


wuzza. does dude out in the world know how to make a password saver. thanks. I am makin' an rpg and it is soooooo
long!!! Is there a way that after i get to like level 5 on frame 799
to make a box come up that shows the password.
and at the beginning of the game there will be a text box and if you type the password in it will go to the frame that you want it to go to. thanx a bunch

Response to Actionscript codes here! 2004-04-03 10:46:36


At 4/2/04 10:09 PM, mac5 wrote: YOU DO NOT NEED TO PUT:

if(condition==false)

You can always say:

if(!condition)

THE ! SIGN MEANS 'NOT'!!!!!!! YOU NEED ACTIONSCRIPT HELP!!!!

It all depends on how oriented with actionscript you are, If you feel more comfortable writing true or false, wright true or false, if you feel like using ! use !, or if you feel like using 1's and 0's (if bla==1, OR if bla ==0) Use 1's and 0's, all im trying to say is just use what your most comfortable with.......... o and STOP YELLING


- Sig provided by ME of the NGSM

- If you try to stay high, your bound to stay low. -

- If I make you a sig, please credit me here -

BBS Signature

Response to Actionscript codes here! 2004-04-03 10:48:38


At 4/2/04 05:48 PM, lordkabita wrote:
At 4/2/04 11:06 AM, Shatter_star wrote: If you make your button, then convert the button to a movieclip, voila you have a nested button nested inside a movieclip and then on the Movieclip you can now use both button...
Yeah, I figured that out, but how do I switch one MC to another MC trough the use of variables?

Im not sure you can....


- Sig provided by ME of the NGSM

- If you try to stay high, your bound to stay low. -

- If I make you a sig, please credit me here -

BBS Signature

Response to Actionscript codes here! 2004-04-03 12:14:10


At 4/3/04 10:36 AM, --Amish-- wrote: So youve already made part of the RPG. And hopw did u make it. It must have been hard. IF not you should be able to make a password box.

Dude. I don't know how! get used to it! so....do you know how.

Response to Actionscript codes here! 2004-04-03 12:17:44


About my rpg. Heres the code i used to make the guy walk around in a sort of 3D world so that when you walk the dude gets smaller as he goes back.

onClipEvent (load) {
// Set the move speed and the srinking size
moveSpeed = 10;
srinkSize = 1;
}
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
}
}

Response to Actionscript codes here! 2004-04-03 14:06:59


can nobody help me? All i want is my character to swing his sword when the "a" key is tapped

this is how my character movieclip is set up:

Frame 1
Label: stand
Movieclip of character lightly bobbing up and down

Frame 2
Label: walk
Movieclip of character walking right on the spot

Frame 3
Label: attack
Movieclip of character swinging his sword

This is the code on the Player movieclip
onClipEvent (enterFrame) {
// Walking left
if (Key.isDown(Key.LEFT) ) {
this._x -= 10;
this._xscale = -100;
gotoAndStop("walk");
} else if (Key.isDown(Key.RIGHT) ) {
this._x += 10;
this._xscale = 100;
gotoAndStop("walk");
} else {
gotoAndStop("stand");
}

This works fine and the character walks and moves left and right when the arrow keys are pressed and held down.

I would like my character to swing his sword when the "a" key is tapped but i can't work out how to do it. Any help appreciated.
Thanks

Response to Actionscript codes here! 2004-04-03 15:32:54


At 4/3/04 07:18 AM, --Amish-- wrote: Ok so this code here... is useless.
Ok so that code will mkae your iobject move up when u press left and right.

tnx, that really works ^^


wibble wabble

BBS Signature

Response to Actionscript codes here! 2004-04-03 15:40:38


At 4/3/04 07:18 AM, --Amish-- wrote: Ok so this code here... is useless.


Ok so that code will mkae your iobject move up when u press left and right.

I made some modifications, but that really helped, I don't have to use Key.getCode(); again ;D
...
onClipEvent (load) {
left = false;
right = false;
speed = 0.00000;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT) && left == false) {
left = true;
right = false;
speed += 0.60000
}
if (Key.isDown(Key.RIGHT) && right == false) {
left = false;
right = true;
speed += 0.60000
}
this._y += -speed;
}


wibble wabble

BBS Signature

Response to Actionscript codes here! 2004-04-03 17:11:07


At 4/3/04 03:40 PM, syko227 wrote:

Congrats on teh 2,500th post!

Response to Actionscript codes here! 2004-04-03 18:47:25


How does one make a button to save some variables or movie clips. Basically, how to save anything from one time to another...

Response to Actionscript codes here! 2004-04-03 22:49:53


Here's a handy code so that u can change the way ur mouse looks.
onClipEvent (enterFrame) {
this._x = _root._xmouse;
this._y = _root._ymouse;
}
onClipEvent (load) {
Mouse.hide();
}

Just put that on the mc that you want to be the mouse

Response to Actionscript codes here! 2004-04-05 10:29:39


At 5/4/03 11:31 PM, Br00d wrote: is there a way to make rain constantly?

make a movie clip


Sig by CoolCatDaddio. <<RESPECT>>

BBS Signature

Response to Actionscript codes here! 2004-04-05 11:05:19


can someone please tell me how to make them banners you lot have...as a signature then put it as a link...and please tell me where i can get sounds and effects from games.

Response to Actionscript codes here! 2004-04-05 12:36:54


Ok....I beleive that this thread shouldn't die. Alot of people need it. So erm....I'm trying to think of a question.....And I can't......
Oh...anyone know any good AS books? Advanced. :P

Response to Actionscript codes here! 2004-04-05 13:03:08


Wow....never knew you could do that kinda thing with AS. Nice.
And by trig. do you meant trigonomatry *mumbles something about bad spelling* 'cause if you do, I pwnzorz my class at trig...I think it's really easy...everyone else struggles with it though...
*sigh*

Response to Actionscript codes here! 2004-04-05 13:18:29


At 4/5/04 12:26 PM, fftadvance wrote: holy crap! thanks guys! i learned a lot!

Your sig is kinda disturbing, calls me uncool...


Swing a Little more!

.. ROCK OUT!

BBS Signature

Response to Actionscript codes here! 2004-04-05 15:31:00


evil ludy ur sig is way cool.......no oneanswered my question on how you make your own one.....programmes....sites...templates???? i really want to make one with my own pictures and that but how???
please?

Actionscript codes here!