00:00
00:00
Newgrounds Background Image Theme

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

421,809 Views | 7,950 Replies
New Topic

Response to Actionscript codes here! 2008-10-17 23:17:41


Thnx for all these codes guys! They are rly helping me! but what the code for stop and starting music? this (i think) is the code to stop it. now how do you start it?

on (release) {
stopAllSounds();
}


The Problems of the Future, by Everyone!

Response to Actionscript codes here! 2008-10-18 12:31:01


i still have a problem. it still doesn't show the level. here's the code:

_root.lvl_warp_2._visible = false;
if (_root.warp_back_1.hitTest(_root._xmouse , _root._ymouse, true)) {
_root.lvl_warp_2._visible = true;
}
_root.lvl_warp_3._visible = false;
if (_root.warp_back_2.hitTest(_root._xmouse , _root._ymouse, true)) {
_root.lvl_warp_3._visible = true;
}
_root.lvl_warp_4._visible = false;
if (_root.warp_back_3.hitTest(_root._xmouse , _root._ymouse, true)) {
_root.lvl_warp_4._visible = true;
}
_root.lvl_warp_5._visible = false;
if (_root.warp_back_4.hitTest(_root._xmouse , _root._ymouse, true)) {
_root.lvl_warp_5._visible = true;
}

and here's the new code i put for the button that takes you back so you see the level.

on (rollOver) {
gotoAndPlay(6)
}

what's wrong?

Response to Actionscript codes here! 2008-10-20 17:30:02


still waiting on a reply here! i need help!

_root.lvl_warp_2._visible = false;
if (_root.warp_back_1.hitTest(_root._xmouse , _root._ymouse, true)) {
_root.lvl_warp_2._visible = true;
}
_root.lvl_warp_3._visible = false;
if (_root.warp_back_2.hitTest(_root._xmouse , _root._ymouse, true)) {
_root.lvl_warp_3._visible = true;
}
_root.lvl_warp_4._visible = false;
if (_root.warp_back_3.hitTest(_root._xmouse , _root._ymouse, true)) {
_root.lvl_warp_4._visible = true;
}
_root.lvl_warp_5._visible = false;
if (_root.warp_back_4.hitTest(_root._xmouse , _root._ymouse, true)) {
_root.lvl_warp_5._visible = true;
}

and here's the new code i put for the button that takes you back so you see the level.

on (rollOver) {
gotoAndPlay(6)
}

what's wrong?

Response to Actionscript codes here! 2008-10-20 22:13:46


Here's a pretty simple one I believe:

Switch way the character's facing by putting your mouse on the other side that they are currently facing,
like in Portal: The Flash Version


GT: Danul454

Response to Actionscript codes here! 2008-10-30 22:36:46


This post shall not die

Response to Actionscript codes here! 2008-11-03 19:01:21


hey guys all of the hittests i use don't work. I use the ones that you see in all the tutorials and in the forums but they don't work. I have flash eaight, AS2. Flash 8 PROOO!!!


.

Response to Actionscript codes here! 2008-11-04 21:12:12


for the last frickin time, I NEED HELP! I want it so when you roll over another warp in another level, a level unlocks in the level select menu. here is the code i put down but is not working!!!

stop();
_root.lvl_warp_2._visible = false;
if (_root.warp_back_1.hitTest(_root._xmouse , _root._ymouse, true)) {
_root.lvl_warp_2._visible = true;
}
_root.lvl_warp_3._visible = false;
if (_root.warp_back_2.hitTest(_root._xmouse , _root._ymouse, true)) {
_root.lvl_warp_3._visible = true;
}
_root.lvl_warp_4._visible = false;
if (_root.warp_back_3.hitTest(_root._xmouse , _root._ymouse, true)) {
_root.lvl_warp_4._visible = true;
}
_root.lvl_warp_5._visible = false;
if (_root.warp_back_4.hitTest(_root._xmouse , _root._ymouse, true)) {
_root.lvl_warp_5._visible = true;
}
_root.lvl_warp_6._visible = false;
if (_root.warp_back_5.hitTest(_root._xmouse , _root._ymouse, true)) {
_root.lvl_warp_6._visible = true;
}
Mouse.show();

Response to Actionscript codes here! 2008-11-10 22:04:23


How Do You Make A Backround Move Infinitely like in Super mario broz Z ep. 6?

Response to Actionscript codes here! 2008-11-10 22:34:38


omg guyz I need helpz makin a mmorpg but Im a noob, can someone give me the code for making elfes and orcs attack eac oithur?

Response to Actionscript codes here! 2008-11-10 22:48:32


At 11/10/08 10:34 PM, Glaiel-Gamer wrote: omg guyz I need helpz makin a mmorpg but Im a noob, can someone give me the code for making elfes and orcs attack eac oithur?

I think i peed myself a little from laughing. :]


what

BBS Signature

Response to Actionscript codes here! 2008-11-10 22:50:31


At 11/10/08 10:48 PM, K-Guare wrote:
At 11/10/08 10:34 PM, Glaiel-Gamer wrote: omg guyz I need helpz makin a mmorpg but Im a noob, can someone give me the code for making elfes and orcs attack eac oithur?
I think i peed myself a little from laughing. :]

oke i trieds that but my mmo isnt workng and now my pannts r wet

Response to Actionscript codes here! 2008-11-10 23:03:27


At 11/10/08 10:50 PM, Glaiel-Gamer wrote: oke i trieds that but my mmo isnt workng and now my pannts r wet

i know, u put de stop() at the beginning an now da rest of the code wont go till u put a play() scriptn00bzorz lulz i kno i rock :O


what

BBS Signature

Response to Actionscript codes here! 2009-01-12 17:14:55


I'm trying to look for a code that when a movie clip touches another movie clip, the variable called "life" goes down. Can someone help me?


$$$ | Strawberry Dodge | Abusive Reviews! | Sig by TheDingo

BBS Signature

Response to Actionscript codes here! 2009-02-22 00:04:48


I am making a point and click game and i am new to flash..i have figured out all the codes for everything but inventory..i take that back..i have figured out the codes for finding hidden objects and having them appear in the inventory but that was just one room...Now i have created four rooms and some navigation buttons so the player can switch from room to room and find different objects in different rooms..problem is that i CANNOT figure out the code for the user to be able to find an object in one room, have it show up in the inventory and then switch rooms via the nav button and still have the piece of inventory that they found in the previous room still be in their inventory...also i want to make everything coincide with each other with the inventory so that when all five objects are found (in different rooms) that my code for the locked door will work....that is, that the door will be unlocked and take the player to final scene when all items are found..Please help....also if anyone knows any good sites for tutorials or templates for point and click games that would be appreciated...and also if anyone know some basic code for point and click games that require the player to combined inventory items and/ or be able to drag items to the screen from inventory(ie key to a door)...thanks a bunch

Response to Actionscript codes here! 2009-03-07 13:04:58


Can you please tell me what am I doing wrong?

onClipEvent (enterFrame) {
if (mouseDown) {
this.gun.gotoAndPlay(2);
}
if (mouseUp) {
this.gun.gotoAndPlay(1);
}
}

Response to Actionscript codes here! 2009-03-07 13:44:26


can u help me?:

How do u create a character and then make flash cut it out and post it somewhere else Example:

I make a dress up game. Then, you press a button and it will appear on a blank frame/


Im Not a jerk, I'm just right.

Response to Actionscript codes here! 2009-03-07 15:34:46


Anyone here know how to remove the Play/Zoom/Stop buttons when you right-click? And quality buttons.

Response to Actionscript codes here! 2009-03-07 19:15:23


root_cm = new ContextMenu();
root_cm.hideBuiltInItems();
_root.menu = root_cm;
root_cm.customItems.push(new ContextMenuItem("My Site", itemHandler));
function itemHandler(obj:Object, item:ContextMenuItem) {
getURL("WWW.SITEHERE.COM/", "_blank");
}
makes it so that you make your own right click menu where it says SITEHERE thats where you put a link so you dont have a blank right click menu

Response to Actionscript codes here! 2009-03-08 06:18:59


Do I have to put it on one frame? Or all?

Response to Actionscript codes here! 2009-04-05 04:33:53


How do I make something go to a certain frame or prev/next frame by hitting a button?

Response to Actionscript codes here! 2009-04-05 04:39:12


Hitting a key*

Response to Actionscript codes here! 2009-10-17 01:48:33


hey i need help making a tower defence game

Response to Actionscript codes here! 2009-10-17 07:54:22


I'm sure this has been asked already but I'm not going to look through al the 285 pages so... how do I get a saving function for levels?


[Hidden Audio Gems]

SoundCloud || YouTube || Facebook

PM me for constructive reviews, collaborations or commissions!

BBS Signature

Response to Actionscript codes here! 2009-10-18 14:50:42


how would you make it so when your character runs over an object it disapeers and text box puts adds one number starting at zero too your money count also how would you make the text box displaying howmuch money yuo have stay at top left of the screen no matter where you goor what you do


need programmers for game. pm me if your interested.

Response to Actionscript codes here! 2009-10-18 15:12:31


At 12/19/06 09:44 PM, Axlenz-FlashElite wrote: Aww doenst work for some reason...

At 12/19/06 03:04 AM, West-End-Pro wrote: use the V-CAM and put:

onClipEvent(enterFrame){
this._x = player._x;
this._y = player._y;
}

an easier substitute for a v-can would be an api look in the first few pages of this topic for the code


need programmers for game. pm me if your interested.

Response to Actionscript codes here! 2009-10-18 16:05:09


sorry for triple post but hears some code and all i need is them too fix the ground hittesting cause it doesent work very well dont do anything else too it
ive got everything set up right but the ground hittest wont work help heer it is send it back when you can thanks onClipEvent(load){ _root.grav=0; _root.xmove=0; _root.attack=false; _root.airatk=false; } onClipEvent(enterFrame){ //CEILING SCRIPT while(_root.ceiling.hitTest(_x,_y-25,tru e)&&_root.grav<0){ _root.grav++; } //WALL SCRIPT while(_root.wall.hitTest(_x+117,_y,true)
&&_root.xmove>0){ _root.xmove--; } while(_root.wall.hitTest(_x-17,_y,true)&
&_root.xmove<0){ _root.xmove++; } //GRAVITY SCRIPT _root.grav+=1; this._y+=_root.grav; while(_root.ground.hitTest(_x,_y,true)){ _y--; _root.grav=0; } if(Key.isDown(Key.UP)&&_root.ground.hitT est(_x,_y+3,true)&&_root.attack==false){ _root.grav=-15; } if(_root.grav>15){ _root.grav=15; } //MOVEMENT SCRIPT this._x+=_root.xmove; if(Key.isDown(Key.LEFT)){ _root.xmove-=1.1; _xscale=-100; } if(Key.isDown(Key.RIGHT)){ _root.xmove+=1.1; _xscale=100; } if(!Key.isDown(Key.RIGHT)&&!Key.isDown(K ey.LEFT)&&_root.xmove>0){ _root.xmove-=2; } if(!Key.isDown(Key.RIGHT)&&!Key.isDown(K ey.LEFT)&&_root.xmove<0){ _root.xmove+=2; } if(_root.xmove>0&&_root.xmove<1.1||_root .xmove<0&&_root.xmove>-1.1){ _root.xmove=0; } if(_root.xmove>1&&_root.xmove<2&&!Key.is Down(Key.RIGHT)){ _root.xmove=0; } if(_root.xmove>10){ _root.xmove=10; } if(_root.xmove<-10){ _root.xmove=-10; } //DISPLAY SCRIPT if(!_root.xmove==0){ _root.attack=false; } if(_root.airatk==false&&!_root.ground.hi tTest(_x,_y+3,true)){ this.gotoAndStop(5); } if(!Key.isDown(Key.RIGHT)&&!Key.isDown(K ey.LEFT)&&!_root.xmove==0&&_root.ground.
hitTest(_x,_y+3,true)){ this.gotoAndStop(3); } if(!Key.isDown(Key.RIGHT)&&!Key.isDown(K ey.LEFT)&&_root.xmove==0&&!Key.isDown(65 )&&_root.attack==false&&_root.ground.hit Test(_x,_y+3,true)){ this.gotoAndStop(1); } if(_root.ground.hitTest(_x,_y+3,true)&&_
root.attack==false&&Key.isDown(Key.LEFT)
){ this.gotoAndStop(2); } if(_root.ground.hitTest(_x,_y+3,true)&&_
root.attack==false&&Key.isDown(Key.RIGHT )){ this.gotoAndStop(2); } //ATTACK SCRIPT if(Key.isDown(65)&&_root.xmove==0&&_root .ground.hitTest(_x,_y+3,true)){ this.gotoAndStop(4); _root.attack=true; } if(Key.isDown(65)&&!_root.ground.hitTest (_x,_y+3,true)){ this.gotoAndStop(6); _root.airatk=true; } if(!Key.isDown(65)){ _root.airatk=false; } } onClipEvent(enterFrame) { if(_root.player.hitTest(_root.portal)) { nextFrame() } } onClipEvent(enterFrame){ if (_root.this.hitTest(_root.ground){ (_x,_y,true)){ this.gotoAndStop(1); } }


need programmers for game. pm me if your interested.

Response to Actionscript codes here! 2009-10-18 16:29:25


errors fix please
Syntax error.hitTest(_x,_y+3,true)){ this.gotoAndStop(3); } if(!Key.isDown(Key.RIGHT)&&!Key.isDown(K ey.LEFT)&&_root.xmove==0&&!Key.isDown(65 )&&_root.attack==false&&_root.ground.hit Test(_x,_y+3,true)){ this.gotoAndStop(1); } if(_root.ground.hitTest(_x,_y+3,true)&&_

Statement must appear within on/onClipEvent handler&&_root.xmove>0){ _root.xmove--; } while(_root.wall.hitTest(_x-17,_y,true)&

Unexpected '&' encountered&_root.xmove<0){ _root.xmove++; } //GRAVITY SCRIPT _root.grav+=1; this._y+=_root.grav; while(_root.ground.hitTest(_x,_y,true)){ _y--; _root.grav=0; } if(Key.isDown(Key.UP)&&_root.ground.hitT est(_x,_y+3,true)&&_root.attack==false){ _root.grav=-15; } if(_root.grav>15){ _root.grav=15; } //MOVEMENT SCRIPT this._x+=_root.xmove; if(Key.isDown(Key.LEFT)){ _root.xmove-=1.1; _xscale=-100; } if(Key.isDown(Key.RIGHT)){ _root.xmove+=1.1; _xscale=100; } if(!Key.isDown(Key.RIGHT)&&!Key.isDown(K ey.LEFT)&&_root.xmove>0){ _root.xmove-=2; } if(!Key.isDown(Key.RIGHT)&&!Key.isDown(K ey.LEFT)&&_root.xmove<0){ _root.xmove+=2; } if(_root.xmove>0&&_root.xmove<1.1||_root .xmove<0&&_root.xmove>-1.1){ _root.xmove=0; } if(_root.xmove>1&&_root.xmove<2&&!Key.is Down(Key.RIGHT)){ _root.xmove=0; } if(_root.xmove>10){ _root.xmove=10; } if(_root.xmove<-10){ _root.xmove=-10; } //DISPLAY SCRIPT if(!_root.xmove==0){ _root.attack=false; } if(_root.airatk==false&&!_root.ground.hi tTest(_x,_y+3,true)){ this.gotoAndStop(5); } if(!Key.isDown(Key.RIGHT)&&!Key.isDown(K ey.LEFT)&&!_root.xmove==0&&_root.ground.

Unexpected '&&' encountered&&_root.xmove>0){ _root.xmove--; } while(_root.wall.hitTest(_x-17,_y,true)&


need programmers for game. pm me if your interested.

Response to Actionscript codes here! 2010-01-31 00:56:06


new to actionscript but i got some it down..i cant figure out how to make the guys stick to the ground though and when they jump to fall back down


BBS Signature

Response to Actionscript codes here! 2010-04-25 12:12:38


hey guys, im trying to figure this out but ive hit a wall...im makeing a mario game to see how much i know of flash, my problem is that when mario jumps he lands on the floor without problems, but when he jumps he jumps through the pipes. here is the code i used:

onClipEvent (load) {
grav_y = 0;
jumping = false;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.UP) && !jumping) {
grav_y = 40;
jumping = true;
}
if (jumping == true) {
grav_y -= 5;
if (grav_y<=-10) {
grav_y = -15;
}
this._y -= grav_y;
}
if (_root.ground.hitTest(this._x, this._y+45, true)){
grav_y = 0;
jumping = false;
}
}

is there something i can add to the code to make mario land on top of the pipes as well? and if so, how? (i made the movie clip of the pipe and named it as pipe)

Response to Actionscript codes here! 2010-04-26 16:01:50


....I even made my own thread about this, but maybe one of you can help me here.

Here's the code:

man_walk(); } function man_walk (Key): void { switch (Key) { case "LEFT" : man._rotation = 270; man._x -= 4; man.gotoAndStop(2); break; case "RIGHT" : man._rotation = 90; man._x += 4; man.gotoAndStop(2); break; case "UP" : man._y -= 4; man._rotation = 0; man.gotoAndStop(2); break; case "DOWN" : man._y += 4; man._rotation = 180; man.gotoAndStop(2); break; default: break; } }

Im trying to make the code for movement of a character for an rpg game much easier to read by putting it into a switch method, only problem is that I need a keylistener, but I dont know how to put one in my code, and connect it back to the program for this code to work.

Again, all I'm doing is trying to make the code that makes a character move using WASD keys more simpler, but I dont know the Full Code or the exact way how. So, all I need is just some help....

And for God's sake, someone help me, lol! I've been on like 10 different forums, with almost no luck xD....thanks in advance. ~Devicer4321