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,059 views • 8,506 replies)

This topic is 284 pages long. [ 1140278 | 279 | 280 | 281 | 282 | 283 | 284 ]

<< < > >>
None

NewFounder

Reply To Post Reply & Quote

Posted at: 7/20/07 02:00 AM

NewFounder NEUTRAL LEVEL 04

Sign-Up: 07/02/07

Posts: 299

When the user presses "space" i want a bullet to spawn from my players gun and if it's touches an enemy for the enemy to die.

BBS Signature

None

Nelson15

Reply To Post Reply & Quote

Posted at: 7/20/07 03:10 AM

Nelson15 DARK LEVEL 13

Sign-Up: 04/16/06

Posts: 397

Stops the movie from playing.

stop();

BBS Signature

None

Felix-The-Cat

Reply To Post Reply & Quote

Posted at: 7/20/07 10:31 PM

Felix-The-Cat NEUTRAL LEVEL 10

Sign-Up: 08/05/05

Posts: 358

Does anyone have actionscript for a pinball game? I know there has to be some gravity. I just need code for the flippers & the springs.

If you're thinking it, NO! I'm not the same person as that old black & white cartoon character.


Sleeping

Degrade

Reply To Post Reply & Quote

Posted at: 8/18/07 10:01 PM

Degrade DARK LEVEL 02

Sign-Up: 08/14/07

Posts: 2

Hey Dudes!

I was wondering if anybody could give me a hand with a little game I'm making...I've done several movies before using Flash, but I've never tried to make a GAME. That's why I'm not that good on ActionScripting....Well, anyway, I'm making a point-and-click game, and I've got all the Actions Scripting I could need....except for one little code...I'll explain the problem now:

I've got this door (which is an MC) that sould open if I click on it ONLY if another MC (called "circle") has a certain value for the x axis (350). When I say "open" I mean that it plays starting from the second frame, which is an animation of the door opening. Well, I have this other button that makes the circle get those coordinates, so when I click on that button, well..you guessed, "circle" gets 350 as a value for the x axis. then, when I click on the door, it opens (as it should do). However, if I click on the door before clicking on the other button, "circle" gets 350 as it's value for x and then the door opens.... I can't understand what's going wrong with the code... well, here it is in case any of you can help me with this:

This is on the door:

onClipEvent(mouseUp){
if(_root.circle._x=350.0) {
if(this.hitTest(_root.cursor)){
gotoAndPlay("circleMC",2)
}
}
}

This is on the burron that moves the circle:

on (release) {
_root.circle._x=350.0
_root.circle._y=183.0;
}

Thanks anyway :)

.:Degradé:.

BBS Signature

None

rickyboyce

Reply To Post Reply & Quote

Posted at: 8/18/07 10:32 PM

rickyboyce LIGHT LEVEL 08

Sign-Up: 07/09/07

Posts: 198

heyy there guys
i was wondering if you actionscript genuses could give me a hand in a simpe stickman game that im making!

the game includes:
walking
jumping (not using gravity but instead a movieclip!)

i have an .FLA here of what if done

what im trying to do here is to have it so the stickman walks left and right and jumps using a fordflip movieclip!
i cant get the fordflip/jump right as you have to HOLD down the space key

can any1 help??
thanks guys

account moved, delete this account tom...please lol


None

Degrade

Reply To Post Reply & Quote

Posted at: 8/19/07 10:43 PM

Degrade DARK LEVEL 02

Sign-Up: 08/14/07

Posts: 2

At 8/18/07 10:01 PM, Degrade wrote: Hey Dudes!

I was wondering if anybody could give me a hand with a little game I'm making...

Hey Guys, already sorted it out. Thanks anyway ;)

D%u02DC

.:Degradé:.

BBS Signature

Mad as Hell

MixedDrink

Reply To Post Reply & Quote

Posted at: 8/19/07 11:13 PM

MixedDrink DARK LEVEL 12

Sign-Up: 03/21/07

Posts: 407

Wow, I saw this thread 18 hours ago, and it had like 3 pages XD

| Email | PM | Underground Flash :D | Whoah, I'm not touching that with my 3 foot penis. ;D

BBS Signature

None

JacYeahMe

Reply To Post Reply & Quote

Posted at: 8/19/07 11:40 PM

JacYeahMe LIGHT LEVEL 08

Sign-Up: 08/15/07

Posts: 95

At 8/19/07 11:13 PM, MixedDrink wrote: Wow, I saw this thread 18 hours ago, and it had like 3 pages XD

Seems like a lot of people don't know Actionscript..

Including me. :S

BBS Signature

None

Turd-Of-The-Week

Reply To Post Reply & Quote

Posted at: 8/20/07 12:49 AM

Turd-Of-The-Week LIGHT LEVEL 13

Sign-Up: 05/25/06

Posts: 1,302

done millions of times but....heres my snow/rain script
also duplicate script

onClipEvent (load) {
//when the clip is first loaded up
movieY = 400;
movieX = 550;
//MOVIECLIP INFO EDN HERE
//RANDOM SCRIPT START HERE
_alpha = 50+Math.random()*100;
_xscale = ["smallest X"]+Math.random()*["largest X"];
_yscale = ["smallest Y"]+Math.random()*["largest Y"];
this._x = 0+Math.random()*movieX;
this._y = 0+Math.random()*movieY
//EDN OF RANDOMIZE SCRIPT
//info scripts NOW
data1 = .5+Math.random()*1.5;
data2 = movieX-movieX-15
data3 = .1+Math.random()*5;
}
onClipEvent (enterFrame) {
this._y += data1;
//....Y is added Data1
this._x += data3;
//....X is added Data3
//loop script
if (this._y>=movieY) {
//if our snowflake hits the edge of our screen
this._y = -15;
//its sent to neg. 15
}
//loop script2
if (this._x>=movieX) {
this._x = data2;
//Its sent to a neg. area
}
}
//I'm going to try an anti-laq version soon

duplicate script...

for (k=0; k<100; k++) {
duplicateMovieClip(this.flake, "snow"+k, k);
}

when in doubt.... punch HAMZ10 IN THE FUCKING FANNY!

BBS Signature

None

sirtom93

Reply To Post Reply & Quote

Posted at: 8/20/07 01:04 AM

sirtom93 FAB LEVEL 20

Sign-Up: 12/22/06

Posts: 7,237

what code do i use to display the current frame number in dynamic text box with var power1 and the movieclip to get the frame number from is instance powerbar


None

West-End-Pro

Reply To Post Reply & Quote

Posted at: 8/20/07 06:49 AM

West-End-Pro NEUTRAL LEVEL 23

Sign-Up: 02/15/06

Posts: 2,354

At 8/20/07 01:04 AM, sirtom93 wrote: what code do i use to display the current frame number in dynamic text box with var power1 and the movieclip to get the frame number from is instance powerbar

Don't understand what you mean on the second question, but use the _currentframe function.

i.e. _root.power1.text = _currentframe;

Well, somin like that.

None

RiotFlash

Reply To Post Reply & Quote

Posted at: 8/20/07 07:30 AM

RiotFlash NEUTRAL LEVEL 08

Sign-Up: 12/11/06

Posts: 1,138

Here is a great basic circle to shape hitTest:

onClipEvent (load) {
radius = #
//make that the radius of your circle
}
onClipEvent (enterFrame) {
for (=0; i<360; i+=5) {
X = (Math.cos(i*(Math.PI/180))*radius)+_x;
Y = (Math.sin(i*(Math.PI/180))*radius)+_y;
if (_root.shape.hitTest(X, Y, true)) {
trace("teh boomzors!")
//written by RiotFlash!
}
}
}

That checks for hitTest every 5 degrees. No lag!

Siggy for rent.
$2 a month.
PM for details.


None

Pedochu

Reply To Post Reply & Quote

Posted at: 8/20/07 10:09 AM

Pedochu FAB LEVEL 02

Sign-Up: 05/15/07

Posts: 602

At 8/20/07 07:30 AM, RiotFlash wrote: onClipEvent (load) {
radius = #
//make that the radius of your circle
}
onClipEvent (enterFrame) {
for (=0; i<360; i+=5) {
X = (Math.cos(i*(Math.PI/180))*radius)+_x;
Y = (Math.sin(i*(Math.PI/180))*radius)+_y;
if (_root.shape.hitTest(X, Y, true)) {
trace("teh boomzors!")
//written by RiotFlash!
}
}
}

No, you didn't write that. It's from 23450's tutorial in AS: Main on Circle to Shape Collisions. All you did was make a tiny edit in the for() loop after posters suggested that he change the loop. Which means it wasn't really your edit. And then you changed the text to trace. Which doesn't really count as an edit. Nice job.

Yes.


None

Denvish

Reply To Post Reply & Quote

Posted at: 8/20/07 10:15 AM

Denvish DARK LEVEL 42

Sign-Up: 04/25/03

Posts: 15,933

At 8/20/07 10:09 AM, Pedochu wrote: No, you didn't write that.

_root.pwned=true;

- - Flash - Music - Report Abuse - -
Not around any more, see last news post.

BBS Signature

None

AcidSoldier

Reply To Post Reply & Quote

Posted at: 8/20/07 12:27 PM

AcidSoldier DARK LEVEL 12

Sign-Up: 11/01/05

Posts: 2,086

I have Flash AS2.0 Garage

Steam Account: boomman123321 Windows Live: riam_neopet8@hotmail.com (Made it when I was 8)
Email(s): riam_lf9@yahoo.com,riam_neopet8@hot mail.com,acidsoldier@bioacid.co.uk

BBS Signature

Misunderstood

Wonderer

Reply To Post Reply & Quote

Posted at: 8/29/07 09:31 AM

Wonderer LIGHT LEVEL 04

Sign-Up: 11/29/03

Posts: 84

hi! Does anybody know how to make a code that you create people with properties like just with numbers. I've only got Flash MX .

What i mean is that i am trying to make a game which needs alot of made up people for example like an AI of a lot of people. I've got an idea of giving those people a number of several things e.g. confidence, strength, income, hitpoints. I need to give a random number for each of these things for each person with out making loads of textfield myself, because it was way too much if i need 10000 for example.

I was wondering if there is any code that can generate the number of people i want that has got properties from the random number?

THANK YOU SO MUCH

success of the helped code will definatly be in the credit


Happy

bennej1

Reply To Post Reply & Quote

Posted at: 9/5/07 07:38 AM

bennej1 NEUTRAL LEVEL 01

Sign-Up: 04/12/07

Posts: 2

Hi
I was wondering if you could help me ?
have you got a code tht will cancel left and right click

thx


None

Pedochu

Reply To Post Reply & Quote

Posted at: 9/5/07 11:37 AM

Pedochu FAB LEVEL 02

Sign-Up: 05/15/07

Posts: 602

At 9/5/07 07:38 AM, bennej1 wrote: Hi
I was wondering if you could help me ?
have you got a code tht will cancel left and right click

thx

What do you mean? Can you explain that a bit more?

Yes.


Happy

bennej1

Reply To Post Reply & Quote

Posted at: 9/6/07 07:04 AM

bennej1 NEUTRAL LEVEL 01

Sign-Up: 04/12/07

Posts: 2

I've made a flash game (http://bennej1.deviantart.com/art/MOUSE -POINTER-GAME-2-58923224)
but you can cheat by holding in the left mouse button and moving to the end
and i was wondering if you knew a actionscript code that will not allow left mouse click


None

Somedude123459

Reply To Post Reply & Quote

Posted at: 9/6/07 03:55 PM

Somedude123459 NEUTRAL LEVEL 01

Sign-Up: 08/24/07

Posts: 4

Can somebody quickly give me the actionscript for a magic 8 ball plz? I've tryed but,...


Expressionless

shinybootman

Reply To Post Reply & Quote

Posted at: 9/6/07 07:26 PM

shinybootman NEUTRAL LEVEL 02

Sign-Up: 06/25/07

Posts: 3

can someone please post an AS code for multiplayer in your game? cuz i really suck at flash and i just copy and paste codes. idk how everyone knows all this kind of stuff its just so confusing. (the only AS i know by heart are buttons and drag and drop) :(

rar! AS so hard! grrrrrrrrrrrrrrrrrr!!!! someone help me out with this crap, i cant even make a side scrolling game (like mario) someone! help!


Happy

hiddencamy

Reply To Post Reply & Quote

Posted at: 9/25/07 02:32 AM

hiddencamy LIGHT LEVEL 18

Sign-Up: 08/23/07

Posts: 188

guys how do we show the person in the back ground


Happy

Nyubis

Reply To Post Reply & Quote

Posted at: 10/1/07 04:42 AM

Nyubis DARK LEVEL 10

Sign-Up: 07/24/07

Posts: 32

make a variable called "mySoundVolume"
and name the sound "mySound"
Then add this actionscript to the button:

mySoundVolume=0;
mySound.setVolume(mySoundVolume);

HTH

(\ (\
( ^_^)
(_(")(") This is Bunny. Copy and paste bunny into your signature to let him achieve WORLD DOMINATION!

BBS Signature

None

Nyubis

Reply To Post Reply & Quote

Posted at: 10/1/07 05:19 AM

Nyubis DARK LEVEL 10

Sign-Up: 07/24/07

Posts: 32

At 10/1/07 04:42 AM, Nyubis wrote: make a variable called "mySoundVolume"
and name the sound "mySound"
Then add this actionscript to the button:

mySoundVolume=0;
mySound.setVolume(mySoundVolume);

HTH

that's for a mute button

(\ (\
( ^_^)
(_(")(") This is Bunny. Copy and paste bunny into your signature to let him achieve WORLD DOMINATION!

BBS Signature

Happy

Nyubis

Reply To Post Reply & Quote

Posted at: 10/1/07 05:25 AM

Nyubis DARK LEVEL 10

Sign-Up: 07/24/07

Posts: 32

bookmark button in flash!!
give a button on release the get url action
and make it like this

on (release) { getURL ("javascript:window.external.AddFavorite ('http://www.newgrounds.com','everything by everyone)"); }

i translated it from dutch, got the script on his site

http://www.bewired.nl/actionscript.php?t itel=bookmark

(\ (\
( ^_^)
(_(")(") This is Bunny. Copy and paste bunny into your signature to let him achieve WORLD DOMINATION!

BBS Signature

Elated

Nyubis

Reply To Post Reply & Quote

Posted at: 10/1/07 08:59 AM

Nyubis DARK LEVEL 10

Sign-Up: 07/24/07

Posts: 32

At 9/6/07 03:55 PM, Somedude123459 wrote: Can somebody quickly give me the actionscript for a magic 8 ball plz? I've tryed but,...

make 2 layers;
in the first one: 10 frames with answers(each frame has a stop() action
in the second layer: a button with the following code

on (release) { what_number = Number(random(10))+2;
tellTarget ("/random_number") { gotoAndStop(/:what_number);

ctrl+enter to test

hth

(\ (\
( ^_^)
(_(")(") This is Bunny. Copy and paste bunny into your signature to let him achieve WORLD DOMINATION!

BBS Signature

None

Nyubis

Reply To Post Reply & Quote

Posted at: 10/3/07 07:49 AM

Nyubis DARK LEVEL 10

Sign-Up: 07/24/07

Posts: 32

At 9/6/07 07:04 AM, bennej1 wrote: I've made a flash game (http://bennej1.deviantart.com/art/MOUSE -POINTER-GAME-2-58923224)
but you can cheat by holding in the left mouse button and moving to the end
and i was wondering if you knew a actionscript code that will not allow left mouse click

I suppose in your game everything except the path is a button.
so this button should have a code like on (rollOver); goto...
you should add: on (dragOver); goto...

that disables the left-mouse-button way of cheating. for the right mouse button: no single idea

but if these people want to cheat: their problem

(\ (\
( ^_^)
(_(")(") This is Bunny. Copy and paste bunny into your signature to let him achieve WORLD DOMINATION!

BBS Signature

None

Ringwraith1

Reply To Post Reply & Quote

Posted at: 10/3/07 11:50 AM

Ringwraith1 DARK LEVEL 13

Sign-Up: 02/05/05

Posts: 134

Ok, I don't really have time to read through 283 pages, so here is my question. Im trying to make a pause button for a pong game and nothing is working. I started a thread and what I was told to do didn't work. If you check out the thread "making a pause button for pong" you can see what the people told me to do. When I did what they say, either the game freezes or nothing happens at all. If anyone knows what I am doing wrong or know how to do it, some suggestions would be appreciated, because flash is really starting to piss me off right now, because whatever I try doesn't work. Someyimes there are lots of errors like "statement must appear within a handler" or "statement must be terminated by "}" " or "syntax error" Someone plz help!

BBS Signature

None

gankro

Reply To Post Reply & Quote

Posted at: 10/3/07 12:34 PM

gankro EVIL LEVEL 11

Sign-Up: 09/16/06

Posts: 1,136

At 10/3/07 11:50 AM, Ringwraith1 wrote: Ok, I don't really have time to read through 283 pages, so here is my question. Im trying to make a pause button for a pong game and nothing is working. I started a thread and what I was told to do didn't work. If you check out the thread "making a pause button for pong" you can see what the people told me to do. When I did what they say, either the game freezes or nothing happens at all. If anyone knows what I am doing wrong or know how to do it, some suggestions would be appreciated, because flash is really starting to piss me off right now, because whatever I try doesn't work. Someyimes there are lots of errors like "statement must appear within a handler" or "statement must be terminated by "}" " or "syntax error" Someone plz help!

create a variable called game, game = 1, and wrap all movement code inside if(game == 1){ then when you pause make game = 0... when you want to play make game = 1... simple as that...

My Coding Portfolio (updated frequently)
If you stay in bed for long enough it will be socially acceptable to go to bed again

BBS Signature

Elated

mattloaf

Reply To Post Reply & Quote

Posted at: 10/3/07 04:27 PM

mattloaf NEUTRAL LEVEL 09

Sign-Up: 06/26/07

Posts: 152

Wow this post helps so much

Rawr Bannana Time :)

BBS Signature

All times are Eastern Daylight Time (GMT -4) | Current Time: 11:55 PM

<< Back

This topic is 284 pages long. [ 1140278 | 279 | 280 | 281 | 282 | 283 | 284 ]

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