00:00
00:00
Newgrounds Background Image Theme

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

392,363 Views | 7,981 Replies
New Topic

Response to Actionscript codes here! 2003-08-24 16:20:15


everyone stop using fargate's jumping script like it's your own. why cant you all create your own, or at least say that it's not yours?

Response to Actionscript codes here! 2003-08-24 16:52:52


At 8/24/03 01:32 PM, PikaExploder wrote: Your welcome. I'm just surprised you didn't ask any questions.

Actually I do have a quastion and I'm sure it's rather simple.
Where do I put that script?!

Response to Actionscript codes here! 2003-08-24 17:03:33


Ah, thanks both of you.

I spent half an hour trying to figure out why it wasnt working.

Instead of
onClipEvent (enterFrame) {
if (hitTest(_root.box)) {
trace("yes/no?")
}

which worked.

I had
onClipEvent(enterFrame){
if (this.hitTest(box)) {
trace("hit");
}
};

Anyway , that's a load of my mind.

Cheers.

Response to Actionscript codes here! 2003-08-24 18:01:49


ok, for the Alien Humanid type game what would the shooting actionscripts be?

Actionscript codes here!

Response to Actionscript codes here! 2003-08-24 19:05:49


At 8/24/03 06:01 PM, Slaughterdemon wrote: ok, for the Alien Humanid type game what would the shooting actionscripts be?

well u only need one script, using duplicateMovieClip, make a bullet mc and use the duplicateMovieClip function in a if loop

~tit

Response to Actionscript codes here! 2003-08-24 19:52:49


OK. Just for a test , I decided to make a boundary.

I've got a box with no colour or anything in the middle. I want to make it so only the outline of the box triggers the hitTest actions.

Response to Actionscript codes here! 2003-08-24 20:03:08


Shooter help please. How do I make it soo when i click a certain movie clip it goes to that movieclip death frame, and also how do i make it when you click and hit an enemy it keeps score. And how do I make the gun a mouse

Response to Actionscript codes here! 2003-08-24 21:04:52


Ahh. After actually thinking about it , I got it.

Response to Actionscript codes here! 2003-08-24 21:14:48


Wow REALLY....
Jee O Midy i wish you would tell me:( wait.....wait for it.......

Actionscript codes here!

Response to Actionscript codes here! 2003-08-24 22:14:21


i dont know if this has been posted yet but you can understand if i dont want to read this entire thread

in alien hominid the agents responded to what you did. like if you bent down then they would bend down and shoot

what kind of script do i put in the mc to make it respond to the other one?

also i want to make it so you press the up button and the guy switches weapons

Response to Actionscript codes here! 2003-08-24 22:34:22


At 8/24/03 10:14 PM, richardp wrote: i dont know if this has been posted yet but you can understand if i dont want to read this entire thread

in alien hominid the agents responded to what you did. like if you bent down then they would bend down and shoot

what kind of script do i put in the mc to make it respond to the other one?

also i want to make it so you press the up button and the guy switches weapons

I really dont know but i can guess. try an if command ( dont know if it will work )

if (_root.(name) == _root.frame name) {
movieclipname.gotoAndPlay(framename)
}
else ( return )

I doubt this will work though i think its close. I use this kinda if commands for mIRC scripting ( for msn )

Response to Actionscript codes here! 2003-08-24 22:43:04


can somebody help me out with the actionscript for a rotating menu where when they hover over one of the buttons the rotating stops? I have kind of an idea for it... it goes like this.

I would make a movie symbol called menu in the menu I would have my buttons.

then in that actionscript of the menu symbol in the first frame of the parent thing I would have.

_rotation = 5;

then in each button I would have...

on(mouseOver)
{
_parent.menu._rotation = 0;
}

would I want to do it like that or make a video of the menu going in a circle and go inside each button and tell it to go to another frame that has a still picture of each button at a still mode?

Response to Actionscript codes here! 2003-08-24 22:53:07


At 8/24/03 10:14 PM, richardp wrote: i dont know if this has been posted yet but you can understand if i dont want to read this entire thread

in alien hominid the agents responded to what you did. like if you bent down then they would bend down and shoot

what kind of script do i put in the mc to make it respond to the other one?

also i want to make it so you press the up button and the guy switches weapons

ok every agent is it's own (attached) movieclip. so on Enterframe they check to see if Key.isDown(Key.Down) to see if the main character is ducking so then they duck: gotoandPlay("ducking_animation"))

for weapons it's just a matter of using the switch function. let's say the variable current_weapon = 2

the layout would be:

if (firing = true) {
firing = false
//
switch (current_weapon)
case 1:
gotoandplay("animation_for_weapon_one");
break;
case 2:
gotoandplay("animation_for_weapon_two");
break
}

btw I used labels for the gotoandplay. They are much more expandable than numbers because if you change the numbers of the frames you'll have to change them in the script functions as well. labels are just easier.

and so forth...

Response to Actionscript codes here! 2003-08-24 23:29:38


okay i am making a RPG, well i have a charecter creator, well i have set all my variables and stuff, but what i want is to make it o where when my skill variabal hits 0 it won't let a buytton add more skills credits... i was thinking of somthing more like..

If (_root.skill=0) (
//next command here

but i am not quite sure can ya help me out as soon as ya can?

Response to Actionscript codes here! 2003-08-24 23:59:23


At 8/24/03 11:29 PM, Snake_0721 wrote: If (_root.skill=0) (
//next command here

try this:

if(_root.skill==0){
//next command here
}

If you are going to test the value of a variable you have to use the "==" operator. "=" only sets the values, not reads them.


I could surely die

If I only had some pie

Club-a-Club Club, son

BBS Signature

Response to Actionscript codes here! 2003-08-25 00:09:45


You're very informative!! i need action script for making movie? or is there such a thing? i'm still learning but i need to know if action script necessary for makig flash MOVIE?

Actionscript codes here!

Response to Actionscript codes here! 2003-08-25 01:14:08


okay i don't get that ==, why should i need it? anyways, well i found a new prob. the add skill butoon stops after i hit it once, anyone know why? i would like them to be hit multiple times. ug i am having so many probs, i just can't wait till i get to battles and walking around. i will be scared forever of this experience

Response to Actionscript codes here! 2003-08-25 01:54:58


Hello,
I'm sure this is really easy and I'm just overlooking something, but I've gotta ask anyway: Ok, so I've got this game, and it's set up so that there's a different 'screen' in each frame (title screen, map screen, inventory screen, etc) The problem's in the map screen. I've got it all set up nice and perfect, it's got walls, they all work nice and perfect, I've got the character, he walks around all nice and perfect, everything works like it should EXCEPT the town.
I want to get it set up so when you pass over a town it jumps to the town frame. I figger, fine, just do it like the Walls, right? Wrong. (I took the Walls script from here so ya'll should know the setup, I can't remember it offhand, something to the effect of: If the MC hits the Walls, then do not move the character) I thought I could just stick a gotoAndPlay(3) in there and it would jump to the Town frame, but it doesn't wanna, it just sits there and stops the movie.
I figger it has something to do with the AS not being on the same level, but flash isn't co-operating at all, any ideas? Or am I just completely off track?

Response to Actionscript codes here! 2003-08-25 03:51:59


the layout would be:

if (firing = true) {
firing = false
//
switch (current_weapon)
case 1:
gotoandplay("animation_for_weapon_one");
break;
case 2:
gotoandplay("animation_for_weapon_two");
break
}

Ok but where does the up button script go? I'm a beginner so i need it to be explained to me as if I was retarded.

Response to Actionscript codes here! 2003-08-25 07:24:17


ok, i know this has probably been done billions of times before, but im making a 2 player shooting game with one player moving a character around with the arrow keys and the other shooting it(clicking it). i would also like a scoreboard for the shooting player, ammo which, when runs out, goes to a frame and a sound file which plays when a shot is fired anywhere on the screen. so far, ive got the character moving around the screen and ive tried a scoring script i found on this thread, but it didnt work for some reason. thanks.

Response to Actionscript codes here! 2003-08-25 12:46:39


All of what you want is like explained on the first page of the tread.


Swing a Little more!

.. ROCK OUT!

BBS Signature

Response to Actionscript codes here! 2003-08-25 16:49:33


I have another idea of how to do an inventory...:
ok 1.have some variables for each item set on the beginning of ur game or whatever...
2.Then make the items or buttons depends on how u want ur game.
3.put the code on the game (in the area where u walk or do something...) then add this code to it: onClipEvent (enterFrame) {if(this.hitTest(_root.characterinsatancename)){_root.moviecliporbutton._vi
sible = true; //can be more than one keep duplicating the whole block of code and change it around...
}
}
4. then add ur items to the place where the inventory will be then add this code to it then u can add other stuff...: onClipEvent (load) {
this._visible = false;
}
5. DONE! :) have fun with the script...

Response to Actionscript codes here! 2003-08-25 17:00:16


:P sorry im a bad explainer it can be a button or a movieclip, the beggining the varibles are like: something = false;
and add this to the get code:
something = true;
then ur fixed if i forgot something tell me...

Response to Actionscript codes here! 2003-08-25 17:22:11


ok guys get this i need so much help i need eather someone to show me WTF i am doeing or hit me contiunsly with a shovel in one hand and a hammer in the outher i just dun get how to use flash i suck :( i cant even get your car script to make my object move

Response to Actionscript codes here! 2003-08-25 17:45:46


use arrays for inventory.

Response to Actionscript codes here! 2003-08-25 17:48:47


PLz help, okay i got that button thing figured out but i am still stuck on how to get my button disabled when a dynamic text stat hit 0, plz help me. i promise this game is gonna be a good one

Response to Actionscript codes here! 2003-08-25 18:31:58


hello I am making an adult type game and I was doing this code for a bar scene and having trouble. someone plz help. here is the code...size2 is the input and barLine is what the bartender says.

if(size2 == "large")
{
price = 5;
barLine = "That will be" + size2 + " bucks mister."
}
else if(size2 == "medium")
{
price = 3;
barLine = "That will be" + size2 + " bucks mister."
}
else if(size2 == "small")
{
price = 1;
barLine = "That will be" + size2 + " bucks mister."
}
else
{
barLine = "Please Pick a real size."
}

Response to Actionscript codes here! 2003-08-25 18:44:22


sorry for all those its...

barLine = "That will be " + price + "bucks mister.";

Response to Actionscript codes here! 2003-08-25 21:28:19


How do Arrays work?

Response to Actionscript codes here! 2003-08-25 23:42:00


arrays organize data so you don't have to use lots of variables. For inventories most games utilize multidimensional arrays for organization and efficiency.

example of multidimensional array. open up new movie and put this in the first frame.

// arrays are like cabinets. a multidimensional array is like a cabinet with folders.
// each folder containing the same data, organized the same way.
// while index is the cabinet itself, index[0] points to the first folder
// and index[0][0] points to the first file of the first folder, which is incidentally a data value.

// in this example umbrella is the first, the second is a boolean (to see if the user has the item) and the last is the amount
// a numerical value.

index = [["umbrella", false, 0], ["hat", true, 1], ["gun", true, 1], ["keys", true, 2]];
for (i = 0;i<index.length;i++) {
// notice that umbrella is excluded from the loop because the second value is null.
if (index[i][1] == true) {
trace("You have "+index[i][2]+" "+index[i][0]);
}
}

// arrays can be easily modified as well. simply by setting

index[0][1] = true
index[0][2] = 1

// you now have 1 umbrella
// parse through the loop again ( we usually avoid repetetive coding with functions but in this case it's just a demonstration)

for (i = 0;i<index.length;i++) {
// notice that umbrella is excluded from the loop because the second value is null.
if (index[i][1] == true) {
trace("You have "+index[i][2]+" "+index[i][0]);
}
}