00:00
00:00
Newgrounds Background Image Theme

Bowtotheman 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,069 Views | 7,981 Replies
New Topic

Response to Actionscript codes here! 2003-12-27 13:02:59


i'm making a game where this character (nate), who is a couch potato, lost his remote, and needs to get it back. i'm an ok scripter, but i can't work with hittest to save my life.

I have nate, and i have an mc instance name, remote. i need it so that when nate runs into the remote, it plays the next scene.

this is what i have for the remote mc:

onClipEvent (enterFrame) {
if (this.hitTest(_root.nate)) {
true;
nextScene();
}
}

and nate walks right through it! can someone help me, please?

Response to Actionscript codes here! 2003-12-27 14:33:20


I was wondering if someone would help me out with a game engine Im working on.... I have an MC, with the linkage name of "house1" and an instance name "house1", And I have a button with :
on (release) {
attachMovie("house1", "house", 10);
_root.house.startDrag(true);
}
Then in the houses AS I have :
onClipEvent (mouseDown) {
this.stopDrag();
}

Now what that does is when you click on the button It takes the House MC, Now the Problem is I want it so that If you click on the button It will create another house MC without deleting the first? Hopefully I explained myself well enough :)


- 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! 2003-12-27 16:24:32


I am trying to get an actionscript that lets me toggle between 3 sets of graphic symbols. (Each set contains 30 symbols). Basically I want to create a little toggle menu that just changes the symbols. Can anyone help???

Response to Actionscript codes here! 2003-12-27 16:55:33


At 12/27/03 04:24 PM, Faithhammer wrote: I am trying to get an actionscript that lets me toggle between 3 sets of graphic symbols. (Each set contains 30 symbols). Basically I want to create a little toggle menu that just changes the symbols. Can anyone help???

I think I know what you mean,do you want something where users can select a graphic e.g.dog and it will goto a pic of a dog?

Response to Actionscript codes here! 2003-12-27 17:07:16


At 12/27/03 04:55 PM, Nova_dragon wrote:

I think I know what you mean,do you want something where users can select a graphic e.g.dog and it will goto a pic of a dog?

Well, sorta. I want it to toggle between different classification. Light, Neutral, Dark. Light would show the 30 light symbols all on one frame, nuetral all nuetral, etc etc. Go here http://www.newgrounds.com/portal/view.php?id=142163 and you will see what I am trying to do.

Response to Actionscript codes here! 2003-12-27 18:05:00


At 12/27/03 02:33 PM, Shatter_star wrote: I was wondering if someone would help me out with a game engine Im working on.... I have an MC, with the linkage name of "house1" and an instance name "house1", And I have a button with :
...

Okay, all you have to do is have the "house1" movie clip in the library. Now, put this on the button:

on (release) {
attachMovie("house1", "house" + j, j++);
this["house" + j].startDrag(true);
this["house" + j].onMouseDown = function() {
stopDrag();
this.onMouseDown = null;
};
}

And that should do the trick.

By the way, there is no need to have an instance of the house movie clip on stage.

Response to Actionscript codes here! 2003-12-27 18:05:01


i need help on double guns and diveing plz

Response to Actionscript codes here! 2003-12-27 18:20:37


At 12/27/03 06:05 PM, DespairJR wrote: i need help on double guns and diveing plz

Well I could help you on that but Onfortunatly I dont know what other scripts you've used and how the character is buld...

Anyways you could program the double wapens just as one weapon, but then put an animation in it that you see 2 guns...


Swing a Little more!

.. ROCK OUT!

BBS Signature

Response to Actionscript codes here! 2003-12-27 18:20:39


Thanks, CrookedAsterisk the script does just what I wanted : )


- 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! 2003-12-27 18:34:25


At 12/27/03 06:20 PM, Shatter_star wrote: Thanks, CrookedAsterisk the script does just what I wanted : )

No problem!

Response to Actionscript codes here! 2003-12-27 18:35:18


Oh, I just figured out how to do what I wanted. Trial and error works almost every time

Response to Actionscript codes here! 2003-12-28 04:40:03


onClipEvent (enterFrame) {
if (this.hitTest(_root.nate)) {
true;
nextScene();
}
}

and nate walks right through it! can someone help me, please?

The code you have has only one problem. This is what you SHOULD use. Tell me if it works.

onClipEvent (enterFrame) {
if (this.hitTest(_root.nate)) {
this.nextFrame();
}
}

Hope it does what you wanted. Later.

Response to Actionscript codes here! 2003-12-28 05:34:54


How many weapons do you guys think is enough for a cool actions game? I already got 20 programmed...


Swing a Little more!

.. ROCK OUT!

BBS Signature

Response to Actionscript codes here! 2003-12-28 06:54:32


At 12/28/03 05:34 AM, eviLudy wrote: How many weapons do you guys think is enough for a cool actions game? I already got 20 programmed...

I'd say 20 lol,so is this for Makten then?i'm learning actionscripting but i'm more of an animation guy,it takes ages to learn AS.

Response to Actionscript codes here! 2003-12-28 07:22:36


Response to Actionscript codes here! 2003-12-28 07:25:54


At 12/28/03 07:22 AM, mexxa wrote: Vote five
http://www.newgrounds.com/portal/view.php?id=142384

That was sweet,I voted 5.

Response to Actionscript codes here! 2003-12-28 08:37:02


At 12/28/03 07:22 AM, mexxa wrote: Vote five
http://www.newgrounds.com/portal/view.php?id=142384

Thanks for voting, eviLudy!
Your experience points gave you a voting power of 5.79 votes. Your blam and protection points gave you an additional 14% of your experience power, meaning that your total vote power was worth 6.60 votes!

The more experience points you have combined with BLAM and PROTECTION points, the more your vote is worth!

You gave this entry a 5, raising its score to 3.54!
If this movie is protected you will get a PROTECTION point!

Your experience points have been deposited already today. Thanks for doing the overtime!

Happy Now?


Swing a Little more!

.. ROCK OUT!

BBS Signature

Response to Actionscript codes here! 2003-12-28 09:06:12


Thank you ure nice, no join the muffin cub

Response to Actionscript codes here! 2003-12-28 10:16:03


At 12/28/03 07:22 AM, mexxa wrote: Vote five
http://www.newgrounds.com/portal/view.php?id=142384

It was cool, but when muffin dude tackeled raspberry clock and then shot him, You should have had some blood splatter on muffin dude, And Also I noticed in the credits you left out pineapple clock


- 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! 2003-12-28 12:40:06


Will someone please tell me how I can concentrate on flash at the moment cuz I want my new game to be done before the end of December (its not somthing for New Year, serious) but I must hurry then and I just can concentrate. Argh


Swing a Little more!

.. ROCK OUT!

BBS Signature

Response to Actionscript codes here! 2003-12-28 12:51:34


Hey u people have a pretty big post goin... well ill join in

how do you make an object follow your mouse like one of those FPS games. and also how do i program an object to move certain directions whenever i press a certain button and how much did that book cost.

i will be extremely thankful if u people help me out

P.S. i have no experience with ActionScript

-Splurge

Response to Actionscript codes here! 2003-12-28 14:04:46


Hey guys, I finally created a somewhat smart enemy A.I. for my game. I'll give you the basic part of the code, its just the part that makes the enemy follow your player and you can change how fast you want him to follow eaily, I dont have time to give out the full tutorial on making a full attacking enemy.

here it is------------------

//--------------put this in your enemy---------------------
onClipEvent(load){
speed = 3;}
onClipEvent (enterFrame) {
if (_root.guy._x<this._x && !this.hitTest(_root.guy)) {
this._x -= speed;
_xscale = 10;
} else if (_root.guy._x>this._x && !this.hitTest(_root.guy)) {
this._x += speed;
_xscale = -10;
}
}
//---------------------put this in your guy-----------------------
onClipEvent(enterFrame({
if(Key.isDown(Key.RIGHT)){
this._x+=10;}
else if(Key.isDown(Key.LEFT)){
this._x-=10;}
}
//----------------------code ends here------------------

Now you need your give your character the instance "guy", and now you can walk around and the enemy will follow you, this can be used to make escort games as well.

Response to Actionscript codes here! 2003-12-28 14:10:12


sorry guys, I made a small mistake in the "guy's" onClipEvent handler, its like this "(enterFrame(" please change it to "(enterFrame)".

Response to Actionscript codes here! 2003-12-28 15:07:00


At 12/28/03 02:04 PM, Freek_Sk8er wrote: Hey guys, I finally created a somewhat smart enemy A.I. for my game.

Didn't test it but the code looks nice enough!


Swing a Little more!

.. ROCK OUT!

BBS Signature

Response to Actionscript codes here! 2003-12-28 15:15:03


At 12/28/03 12:51 PM, Splurge576 wrote:

:and also how do i program an object to move certain directions whenever i press a certain button

onClipEvent (enterFrame){
movespeed = 5;
}
onClipEvent (keyDown){
if (Key.isDown(Key.RIGHT)){
this._x += movespeed;
}
}


- 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! 2003-12-28 17:16:45


Here's a nice little script I know you guys will like...
Just put this on a blank frame and set the framerate to 20:

_global.sw = Stage.width;
_global.sh = Stage.height;

this.createEmptyMovieClip("border", 0);
with (border) {
lineStyle(3, 0xCCCCCC, 75);
lineTo(sw, 0);
lineTo(sw, sh);
lineTo(0, sh);
lineTo(0, 0);
}

this.createEmptyMovieClip("ship", 1);
with (ship) {
beginFill(0x333366, 85);
lineStyle(1, 0x000000);
moveTo(0, -15);
lineTo(-10, 15);
curveTo(0, 5, 10, 15);
lineTo(0, -15);
endFill();

this.onEnterFrame = function() {
if (Key.isDown(Key.LEFT)) _rotation -= 7;
if (Key.isDown(Key.RIGHT)) _rotation += 7;

gx = Math.cos((_rotation - 90) * (Math.PI / 180));
gy = Math.sin((_rotation - 90) * (Math.PI / 180));
if (Key.isDown(Key.UP)) {
ax += gx * 2;
ay += gy * 2;
} else {
ax *= .9;
ay *= .9;
}
_x += ax;
_y += ay;

if (_x < 0) _x = sw;
if (_x > sw) _x = 0;
if (_y < 0) _y = sh;
if (_y > sh) _y = 0;

if (ax > 15) ax = 15;
if (ay > 15) ay = 15;
if (ax < -15) ax = -15;
if (ay < -15) ay = -15;
};
}

Move with arrow keys.

Response to Actionscript codes here! 2003-12-28 17:31:55


I am making a platform game and it is going pretty well. I am having a problem with something though. I have a character obviously, but I have a platform that moves and I want the character to move with the platform when he jumps on it, but it doesn't work. The code I have is:

if (this.hitTest(_root.char)) {
_root.char._x = this._x;
}

but whenever they collide using that code the character just gets moved to the very edge of the screen. DOes anyone know how to fix this?

Response to Actionscript codes here! 2003-12-28 17:46:57


At 12/28/03 05:31 PM, RejectProductions wrote: if (this.hitTest(_root.char)) {
_root.char._x = this._x;
}

By that code, you're saying, "If the player's bounding box touches the platform's bounding box, then lock the player to the center of the platform."

You should really try another method for that.

Response to Actionscript codes here! 2003-12-28 17:54:25


CrookedAsterisk-

I know I need a new method. That's what I asked for. Can you help?

Response to Actionscript codes here! 2003-12-28 17:58:24


1, 500th post! Wohoo!