Newgrounds.com — Everything, By Everyone.

Checking login status…

USERNAME:

PASSWORD:

Logging in…

Logged in as:
.
Logging out…
Inbox My Account Log Out


Forum Topic: Actionscript codes here!

(196,715 views • 8,513 replies)

This topic is 284 pages long. [ 1104208 | 209 | 210 | 211 | 212248284 ]

<< < > >>
None

Inglor

Reply To Post Reply & Quote

Posted at: 1/27/05 07:30 AM

Inglor NEUTRAL LEVEL 17

Sign-Up: 01/26/03

Posts: 10,958

var mlist;
Mouse.addListener(j);
j.onMouseDown=function(){
//actions when moust is clicked

}


None

Creepy

Reply To Post Reply & Quote

Posted at: 1/27/05 10:04 AM

Creepy EVIL LEVEL 07

Sign-Up: 11/28/04

Posts: 1,241

At 1/27/05 09:50 AM, Kaosboy85 wrote: Heres an EASY question, whats the script again to make a button pause a flash movie and another buttons to play the flash movie?


playbutton

on (release){
_root.play();
}


stopbutton

on (release){
_root.stop();
}


None

ch33ks

Reply To Post Reply & Quote

Posted at: 1/27/05 12:33 PM

ch33ks NEUTRAL LEVEL 31

Sign-Up: 07/28/04

Posts: 1,212

At 1/27/05 10:22 AM, Kaosboy85 wrote: Arg... same question but with sound. .. turning sound on and off?

OK buddy i know how this is done *ahem* first you need two frames in a flash with:

stop();

And frame 2:

stop();
stopAllSounds();

So that the sound stops then.

on each of them.Then your button in both and on the button on frame 1:

on(release){
gotoAndPlay(2);
}

Frame 2:

on(release){
gotoAndPlay(1);
}

So it changes button (sound on/off whatever). And on the first frame you put the audio (sync: Event)

This is a way i made up but i hope someone posts a simple way because this can only be used as a flash on its own =(


None

Webraptor

Reply To Post Reply & Quote

Posted at: 1/27/05 05:34 PM

Webraptor EVIL LEVEL 05

Sign-Up: 10/22/04

Posts: 34

Okay is there a certain script to make a menu? i can't seem to create one is it hard or am i just a complete dumbass...


None

archr666

Reply To Post Reply & Quote

Posted at: 1/27/05 06:18 PM

archr666 NEUTRAL LEVEL 01

Sign-Up: 01/25/05

Posts: 6

is there a way to make the ctrl key disable after like 1 sec, so my players on this game im making cant just hold down control and kill everything.
In addition, is there a way to make an object randomly fall in different places. thx


Happy

iceimp

Reply To Post Reply & Quote

Posted at: 1/27/05 10:28 PM

iceimp NEUTRAL LEVEL 15

Sign-Up: 05/04/04

Posts: 41

may come in handy.


None

Nemo

Reply To Post Reply & Quote

Posted at: 1/27/05 10:48 PM

Nemo NEUTRAL LEVEL 33

Sign-Up: 06/13/03

Posts: 1,898

At 1/27/05 01:59 AM, abigserve wrote: Yo. I want to make a simple white circle follow my cursor, but i want it to leave a 'trail' of circles that dissapear behind it as well when i move it. Is this tougher than it sounds, or am i just a dumbass?
p.s Yes i used SEARCH.

make a white circle. convert it to a movie clip and call it "circle". now make another movie clip and call it "fadecircle". animate it as a circle fading out or whatever. in the last frame of the "fadecircle" clip, put the following script:

this.removeMovieClip();

now drag the "fadecircle" out onto the stage and give it the instance name "fadecircle". now drag the first "circle" out onto the stage and add this script to its actions:

onClipEvent (load) {
a = 1;
this.startDrag(true);
}
onClipEvent (enterFrame) {
duplicateMovieClip(_root.fadecircle, "fadecircle"+a, a);
_root["fadecircle"+a]._x = this._x;
_root["fadecircle"+a]._y = this._y;
a += 1;
}

and that should work. simple, but its a start


None

Nemo

Reply To Post Reply & Quote

Posted at: 1/27/05 10:54 PM

Nemo NEUTRAL LEVEL 33

Sign-Up: 06/13/03

Posts: 1,898

At 1/27/05 03:04 AM, Smith1 wrote: ok here is my problem i have 12 or more MC with the same code and my game is geting slow and my computer is good so i want...
...its probably simple but iv never realy used functions

the reason it runs slow is because you have multiple movie clips with "for" loops that test for conditions 99 times at a time. lets say you have 5 movie clips, with a frame rate of 20. the flash player calculations would be:

99 (for loop tests) x 5 (movie clips) x 20 (frame rate) = 9900 calculations per second

and that is not including everything else you have going on in the scripts, graphics, sounds, whatever. i suggest trying to lower the loop conditions by a lot. if you can, try to get it from 99 to something like 20. that would get you down to 2000 calculations a second which actually runs a lot faster.


None

Smith

Reply To Post Reply & Quote

Posted at: 1/27/05 11:06 PM

Smith EVIL LEVEL 25

Sign-Up: 10/13/04

Posts: 127

At 1/27/05 10:54 PM, Primal wrote: the reason it runs slow is because you have multiple movie clips with

thanks
i'm yet to test it but i'm think your right
and i can bring the loop down to about 20 times PF


None

Robotussin

Reply To Post Reply & Quote

Posted at: 1/28/05 12:01 AM

Robotussin DARK LEVEL 14

Sign-Up: 05/20/03

Posts: 3,420

can i get an as code where i have a person who when walks onto a play button the movie starts?
thanks in advance!

NONONONONONONONONONONNONONONONONO.

BBS Signature

None

Hellraiser

Reply To Post Reply & Quote

Posted at: 1/28/05 12:20 AM

Hellraiser DARK LEVEL 14

Sign-Up: 01/04/05

Posts: 5,937

ey, can somebodyt tell how to make a gun reload every 10 shots.... im making a shooter game and im trying to make it that it has an ammo bar and everytime you shoot, bullets go down and you reload after 10 shots? im so lost and i really need help!!! =)
ty

Vote Hellraiser for mod '08
Team Fortress 2 Crew | Metal Hell

BBS Signature

None

Mr-Brown-Lightning

Reply To Post Reply & Quote

Posted at: 1/28/05 02:12 AM

Mr-Brown-Lightning EVIL LEVEL 09

Sign-Up: 07/23/04

Posts: 3

uh, i wanted to find a code to make fire w/ actionscript. i know theres probably some code in this thread somewhere, but i dont want to slog through all the posts. can somebody help a brotha out? any help is appreciated


None

abigserve

Reply To Post Reply & Quote

Posted at: 1/28/05 04:37 AM

abigserve NEUTRAL LEVEL 04

Sign-Up: 01/07/05

Posts: 38

Excellent! That worked really, really well!

Thanks!


None

stickists

Reply To Post Reply & Quote

Posted at: 1/28/05 03:09 PM

stickists NEUTRAL LEVEL 10

Sign-Up: 11/29/04

Posts: 1

At 1/28/05 12:01 AM, Knives- wrote: can i get an as code where i have a person who when walks onto a play button the movie starts?
thanks in advance!

what you 1st need is the button you want the person to walk onto to be a movie clip and the person a movie clip then you give the button that is now a movie clip an instance of "button"
then you put these actions in the man....
onClipEvent(enterFrame)
{if (this.hitTest( _root.button) ){_root.play();}


None

Insane-Sparrow

Reply To Post Reply & Quote

Posted at: 1/28/05 06:19 PM

Insane-Sparrow EVIL LEVEL 09

Sign-Up: 01/04/05

Posts: 94

Ive got a script for a ball to bounce around the screen. The script goes in a Movie Clip called 'Ball':

onClipEvent(load){

xspeed = random(5)+5;
yspeed = random(5)+5;
}
onClipEvent (enterFrame){

this._x += xspeed;
this._y += yspeed;

if (this._x > 540){
xspeed *= -1;
}
if (this._y > 390){
yspeed *= -1;
}

if (this._x < 10){
xspeed *= -1;
}

if (this._y < 10){
yspeed *= -1;
}
}

Now, I need to make it bounce off a Movie Clip named 'pad' and destroy other Movie Clips called 'block'

Can someone please help???


None

Nemo

Reply To Post Reply & Quote

Posted at: 1/28/05 07:46 PM

Nemo NEUTRAL LEVEL 33

Sign-Up: 06/13/03

Posts: 1,898

At 1/28/05 12:01 AM, Knives- wrote: can i get an as code where i have a person who when walks onto a play button the movie starts?
thanks in advance!

well you won't use a button in this case. you would need a movie clip that looks like a button. so for the entire thing, you need 2 movie clips:

1) Button clip
2) Person clip

im sure you have the ability to find whatever you are looking for to make your person walk, then you would put this in the actions for the "button":

onClipEvent(enterFrame){
if(this.hitTest(person_instance_name){
tellTarget(_root){
play();
}
}
}

you might have to tweak with it but it should work.


DarkAngelProductions NEUTRAL LEVEL 05

Sign-Up: 01/16/05

Posts: 98

First of all what is a platformer?

Secondly how do u make it so like when something jumps up when its comes down and hits like a log in the middle of the air he lands and stays on it?


None

Insane-Sparrow

Reply To Post Reply & Quote

Posted at: 1/29/05 12:46 AM

Insane-Sparrow EVIL LEVEL 09

Sign-Up: 01/04/05

Posts: 94

At 1/28/05 06:19 PM, Insane_Sparrow wrote: Ive got a script for a ball to bounce around the screen. The script goes in a Movie Clip called 'Ball':
Now, I need to make it bounce off a Movie Clip named 'pad' and destroy other Movie Clips called 'block'

Can someone please help???

Please!!! I NEEED HELP WITH THIS!!! PLEASE! It's really important that I get this script!!!


None

WastedWizard

Reply To Post Reply & Quote

Posted at: 1/29/05 05:17 AM

WastedWizard EVIL LEVEL 21

Sign-Up: 01/08/05

Posts: 3,125

wow all of these scripts have really helped me thanks!


None

Nemo

Reply To Post Reply & Quote

Posted at: 1/29/05 08:51 PM

Nemo NEUTRAL LEVEL 33

Sign-Up: 06/13/03

Posts: 1,898

At 1/29/05 12:46 AM, Insane_Sparrow wrote:
At 1/28/05 06:19 PM, Insane_Sparrow wrote: Ive got a script for a ball to bounce around the screen. The script goes in a Movie Clip called 'Ball':
Now, I need to make it bounce off a Movie Clip named 'pad' and destroy other Movie Clips called 'block'

Can someone please help???
Please!!! I NEEED HELP WITH THIS!!! PLEASE! It's really important that I get this script!!!

well for the pad, you need to have a code in it that just reverses the direction of the ball. if the pad is at the bottom of the screen, you might have a code like:

onClipEvent(enterFrame){
if(this.hitTest(_root.ball)){
_root.ball..yspeed = _root.ball.yspeed * -1;
_root.ball._y -= 5;
}
}

the this._y -= 5; is there to move the ball away from the pad a little so it doesnt keep changing direction.

as for the blocks, you should make the blocks a move clip a few frames long. have an exploding animation or something and in the last frame, delete everything so there is no block. then drag your blocks out and add the following script:

onClipEvent(load){
this.stop();
}
onClipEvent(enterFrame){
if(this.hitTest(_root.ball)){
_root.ball.yspeed = _root.ball.yspeed * -1;
_root.ball._y += 5;
this.play();
}
}

you definetley have to play around with the scripts though because you have to figure in that the balls might hit the sides of the blocks, in which case i suggest you make your blocks multiple movie clips inside one movie clip and then add scripts that will change the ball speed depending on how it is traveling.

well i hope that helps a little bit. there are some flaws in it but it is a start.


None

Harpo-1

Reply To Post Reply & Quote

Posted at: 1/30/05 01:13 AM

Harpo-1 LIGHT LEVEL 09

Sign-Up: 01/15/05

Posts: 968

please help anyone. ive allready looked through 30 pages of this thread witch took me about 2 hours because i was testing some of the different scripts. but anyway i need some help.
i have a bunch of (assumingly easy) questions so i numbered them to make it easy for people who can only answer one or two of them.

1.) I have a guy, he is an mc and inside of him is another one of him wwalking left in the first frame and antother of him walking right in the second frame. (i dont need him to go up or down)

but how do i make it so that when i hit right, it makes him walk and what not.

2.) also i need some help where when he walks to the right he walks forever and i want him only to be able to walk the the edge of the screen.

3.) also how do i make it so that when i hit space he does the animation of him attacking and where should i put the animation of him attacking.
right now i have it as another movie clip inside of the first movie clip.

4.) also how do i make it so that people will come in and when i swing and im close enough to them it will hit them?

2b r not2b lawl

BBS Signature

None

Deathcon7

Reply To Post Reply & Quote

Posted at: 1/30/05 01:37 AM

Deathcon7 LIGHT LEVEL 20

Sign-Up: 10/01/03

Posts: 5,139

http://www.newgrounds.com/bbs/topic.php?id=66585&page=203

Second post down. Read it. Then consider this.


Happy

LuckyDesign

Reply To Post Reply & Quote

Posted at: 1/30/05 05:21 AM

LuckyDesign NEUTRAL LEVEL 06

Sign-Up: 11/13/04

Posts: 1,210

hey one question. what code can be used to detect if no key is pressed. Like if you're pressing left on your keyboard to move a character and sudenly you release it. Thanks :)


None

Skribble-Style

Reply To Post Reply & Quote

Posted at: 1/30/05 08:11 AM

Skribble-Style EVIL LEVEL 07

Sign-Up: 05/18/03

Posts: 65

At 1/30/05 05:21 AM, Lucky_design wrote: hey one question. what code can be used to detect if no key is pressed. Like if you're pressing left on your keyboard to move a character and sudenly you release it. Thanks :)

if(!Key.isDown(Key.LEFT)){
//do something
}

if you have an exlaimation mark before a condition, it means; if the condition ISNT happening.


None

RewrittenSoftware

Reply To Post Reply & Quote

Posted at: 1/30/05 03:17 PM

RewrittenSoftware NEUTRAL LEVEL 08

Sign-Up: 01/29/04

Posts: 38

Excellent i love u guys not literally of course <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<3333333333333333333333333333


None

Fallin-Again

Reply To Post Reply & Quote

Posted at: 1/30/05 03:43 PM

Fallin-Again EVIL LEVEL 11

Sign-Up: 08/24/04

Posts: 439

how do u make a movieclip go to another frame thats inside it when you press the right key?And when you press the down key it goes to another frame, and also one more if you press the enter key it will go to the next scene?

BBS Signature

None

Kozak1337

Reply To Post Reply & Quote

Posted at: 1/30/05 03:56 PM

Kozak1337 NEUTRAL LEVEL 14

Sign-Up: 06/27/04

Posts: 873

onClipEvent(enterFrame)
if(Key.isDown(Key.RIGHT);) {
this.gotoAndStop(0);
}
}

set the number in (); to chose the frame to go to


None

BlackSwordDragon

Reply To Post Reply & Quote

Posted at: 1/30/05 04:45 PM

BlackSwordDragon NEUTRAL LEVEL 10

Sign-Up: 08/06/03

Posts: 41

I am making a question and answer game and I need to know how to make the game start over after the player has made three or more wrong answers. Actually it would be best if I had a way to keep track of the answers.


None

Kozak1337

Reply To Post Reply & Quote

Posted at: 1/30/05 05:16 PM

Kozak1337 NEUTRAL LEVEL 14

Sign-Up: 06/27/04

Posts: 873

ok i have no good i dea at the moment but make an MC with a counter:
first frame write in the number 0
second frame write in: 1
third frame write in: 2
fourth frame write in: 3
fifth frame don't write anything but set a:
_root.gotoAndStop(FRAMENUMBER);

change FRAMENUMMBER to the frame in the main timeline where you wan't it to go if the 3 wrong answers

click on the MC in the main timeline and open propertise panel and label the mc: bad as instance name

the buttons with wrong answers:
on(release)
{
gotoAndPlay(NEXTQUIZFRAME);
_root.bad.nextFrame();
}

set NEXTQUIZFRAME to the number of frame the next question is on


None

Kozak1337

Reply To Post Reply & Quote

Posted at: 1/30/05 07:48 PM

Kozak1337 NEUTRAL LEVEL 14

Sign-Up: 06/27/04

Posts: 873

wow recently dicowerd that eviludy is now

_Zer0_ or is it _ZerO_


All times are Eastern Daylight Time (GMT -4) | Current Time: 06:27 AM

<< Back

This topic is 284 pages long. [ 1104208 | 209 | 210 | 211 | 212248284 ]

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