Hi all, I'm sorry if this is annoying or has been asked a million times or if it's in the wrong forum-I'm new.
Anyway I'm looking for some advice for a project Im trying to do, I'm making a very basic flash game in AS2. It's a zombe shooter so basically, zombies enter screen you use the mouse to click+kill, quick little animation of blood then they fade out using the Alpha thing.
My issue is that while I have set it up so that when you click on a zombie the animation does work, it does not recognize individual zombies if you get me. So one click on one zombie and they all fade away which is not what I want, I want the person to have to click each one as the game is simple enough as it is!!
So again I'm doing very very basic flash, nothing complicated at all and have only been at flash for a few weeks. My code so far is this
onClipEvent (mouseUp) {
targetPath(z3);
play();
}

I have this set on one zombie and another I have named Z2 and replace the Z3 with it. I have tried mess with instance names but again no results.
I want to give as much information as possible here so sorry for droning on but basically I made each zombie a movie clip, entered the movie clip added in the death sequence, action stop etc... Then on main timeline/scene added the above actionscript onto each individual zombie but still when i click on one they all disappear and this will totally ruin the thing for me.
I have looked up tutorials but they get so intricate and complicated and I am really just looking for a basic, when you click this zombie X happens and then if you click this zombie X happens...you get the idea.
So if anyone thinks they can help at all I'd really appreciate it.
Again, I'm a total noob, I have no issue in admitting that I don't get a lot of the jargon or technical terms, I would rather just be the artist or concept person but for the sake if this project I have to be able to put in the correct code!! Once I nail this the rest of the game will be a piece of pi$$.

Thanks to anyone who responds....Treat me like an alien who has no idea what flash is!!!!!!!

At 11/9/13 05:43 PM, kkots wrote:
1) Make the fading in the animation.
2) On the last frame of the animation, put code:

removeMovieClip(this);

so just so i know what you mean and i am dense.... Do you mean inside the movie clip of the zombie where it fades to add that code? So then when you play if you click on it just the one will disappear.
Or do you mean put the fade on the main timeline ?

If you have a raw vector drawing instead of a symbol, then make it into a symbol.

I dont know if iv explained myself right.... I wish I could just put up the file..
So i have an animation on my main timeline that sees the zombies enter from the right. I converted the zombies to movie clips individually, then i double click on the zombie and add the death animation. very basic, i use the alpha value to make it fade away and use actions stop.
Next i return to the main timeline and add the code I wrote on my first post to the animation. I do this for both zombies.
When i play the clip, I can shoot the zombies, but when i shoot one both of then play out the animation i created to them and both fade out.
So I need to be able to have it so that when you click on 1 zombie-that zombies death animation plays out instead of both.

At 11/9/13 05:43 PM, kkots wrote:
1) Make the fading in the animation.
2) On the last frame of the animation, put code:

removeMovieClip(this);

this works with regard removing just the one zombie but the little animation still plays of both zombies... So basically when you hit the zombie, it gets covered in blood and then fades out. With this code the zombie you hit gets the blood and fades out but the other zombie also plays the blood animation and just doesnt fade out...
I hope this makes sense....

from your game completely. It will not work.
Instead, make a Button symbol inside your Zombie movie clip, on a separate layer. Make this button 0% alpha (completely invisible), and put this code ON it:

from your game completely. It will not work.
Instead, make a Button symbol inside your Zombie movie clip, on a separate layer. Make this button 0% alpha (completely invisible), and put this code ON it:

from your game completely. It will not work.
Instead, make a Button symbol inside your Zombie movie clip, on a separate layer. Make this button 0% alpha (completely invisible), and put this code ON it:

on(press){
play();
}

ok ill try this and see if it works..thanks btw

the button thing is def the way to go....i need to do a little tweaking but it's my own little issues i think...Thanks so much

At 11/10/13 12:15 PM, bambuy wrote:
the button thing is def the way to go....i need to do a little tweaking but it's my own little issues i think...Thanks so much

Yea, it is around 1000 times faster than hitTest, I made a test where I placed 1000000 of those buttons in an isometric 3D cube application, and it worked absolutely fine, whereas when I used hitTest it was so slow I had to open Task Manager and kill the process.

At 11/10/13 12:15 PM, bambuy wrote:
the button thing is def the way to go....i need to do a little tweaking but it's my own little issues i think...Thanks so much

Yea, it is around 1000 times faster than hitTest, I made a test where I placed 1000000 of those buttons in an isometric 3D cube application, and it worked absolutely fine, whereas when I used hitTest it was so slow I had to open Task Manager and kill the process.

Buttons > hitTest

yeah so i have the button thing set up and it works. My only problem now is that if you click the zombie it disappears-good but if you click that area again the zombie re-appears....not so good.... Any advice??

At 11/10/13 06:59 PM, bambuy wrote:
yeah so i have the button thing set up and it works. My only problem now is that if you click the zombie it disappears-good but if you click that area again the zombie re-appears....not so good.... Any advice??

At 11/10/13 06:59 PM, bambuy wrote:
yeah so i have the button thing set up and it works. My only problem now is that if you click the zombie it disappears-good but if you click that area again the zombie re-appears....not so good.... Any advice??

Remove the button in the animation. Select it and press Delete

hmmm.....i set a keyframe at the end of the button and deleted it... im assuming i cant really delete the button all together or then it just wouldn't work? so confused...

At 11/10/13 06:59 PM, bambuy wrote:
yeah so i have the button thing set up and it works. My only problem now is that if you click the zombie it disappears-good but if you click that area again the zombie re-appears....not so good.... Any advice??

Remove the button in the animation. Select it and press Delete

ok i deleted the button and yes the click does still work... But still if you click on the empty space where the zombie was it re-appears.... So I think what i need is to set it up so that once you click and the animation plays that zombie is completely removed from the game

Button, which you placed inside the Zombie movie clip to register clicks, must exist only on the first frame of the zombie. You must create a Keyframe on the Button's layer and delete the button on that layer.
On the last frame of the animation you need to type

At 11/11/13 12:48 PM, kkots wrote:
Button, which you placed inside the Zombie movie clip to register clicks, must exist only on the first frame of the zombie. You must create a Keyframe on the Button's layer and delete the button on that layer.
On the last frame of the animation you need to type

removeMovieClip(this);

And the Zombie will remove itself.

is there anyway I can upload the file for you to see? I have tried all these things and i do appreciate you all trying to help me out but it's just not working!!
I have within the zombie movie clip a button layer, on the first frame I have the button drawn. I then created another keyframe and deleted the button.
I have actions STOP at the start and end of the zombie movie.
On the main scene, I have this action on the zombie
on(press){
play();
}

I tried add the remove clip to the zombie, to the movie clip etc etc.... But still when i click on the zombie, the movie clip plays, the zombie fades away. But after the zombie fades away, when i click on the now empty space where the zombie was it will reappear again....
I'm going to try upload images maybe to show what is going on...

and this is the zombie movie clip-double click on zombie and this is what i have
button layer on bottom, button on frame one, deleted frame 2
blood folder contains blood etc that goes onto the zombie when you hit it.
The tween on the zombie is again a classic tween which makes the zombie fade out. The final frame of the zombie is the alpha turned down to 0.
The actions layer is on top. First and last action=stop.

At 11/12/13 10:59 AM, kkots wrote:
Inside the zombie symbol:
remove the Button layer (I changed my mind about it)
Go to the last frame on the "actions" layer, hit F9 and ADD THIS CODE to your already existing one:

removeMovieClip(this);

appreciate the help...but i did all that got rid of button within the zombie movie clip added removeMovieClip(this); to the last frame in actions so it now has stop and removeMovieClip(this);
still reappears if you click the space

At 11/12/13 10:59 AM, kkots wrote:
Inside the zombie symbol:
remove the Button layer (I changed my mind about it)
Go to the last frame on the "actions" layer, hit F9 and ADD THIS CODE to your already existing one:

removeMovieClip(this);

appreciate the help...but i did all that got rid of button within the zombie movie clip added removeMovieClip(this); to the last frame in actions so it now has stop and removeMovieClip(this);
still reappears if you click the space

do you think it keeps reappearing because on the main timeline the zombie layer extends out to the end of the animation? But then I suppose if I didn't have it set like that the zombie wouldn't show at all....i wish i could figure this out...

oh my gawd what am i doing wrong?!!!! so all that worked perfectly... But new issue as you can see in the pick the first 2 zombies enter via tween from the right to the stage. works perfect. wen u shoot works perfect

But now I was trying to insert another set of zombies to enter form the left after these ones.... so the idea being that after you shoot the first two another two will enter at some stage.... MY plan was to just simply have them on the time line to enter same as first two.

But for some reason when i place the next zombies on, at the tween etc...they dont enter the stage when i preview the game. Everything else works fine, the background continues to play etc but the next set of zombies wont show up!!!

At 11/13/13 07:50 PM, bambuy wrote:
But for some reason when i place the next zombies on, at the tween etc...

Tweens only work on 1 symbol per layer.

they dont enter the stage when i preview the game.

If you were using a tween, they would not enter even in the Flash IDE, let alone SWF.

Everything else works fine, the background continues to play etc but the next set of zombies wont show up!!!

So the first set of zombies shows up properly, only the next sets are not appearing?

*all caps panicking*

First of all, using a tween to make a game is a horrible idea, but it is possible. So we're going to continue using tweens, so that you do not advance in knowledge/experience faster than your intellect allows.
After you spawn zombies, you must wait until the player kills them, so you must put a stop() command on the main timeline. Not just a stop command, you must also check how many zombies you have, and if 0, then you advance further.

if(zombie_count!=0){
//if zombie_count does not equal 0 then do this
stop();
}else{
play();
}

The problem right now is that zombie_count is not defined anywhere in the game. So you must define zombie_count on the first frame of the main timeline by using code:

zombie_count=0;

Then, inside the zombie, when you remove it, you must ADD this code to the last frame (where you remove the zombie) of the zombie's timeline:

_root.zombie_count--;
//one zombie died, so we decrease the zombie_count by 1
if(_root.zombie_count==0){
//if zombie_count is 0, then resume the game onto the next wave of zombies
_root.play();
}

Now the final problem is that zombie count is never increased. Very simple: increase the zombie count on the first frame of the zombie, where you have a stop command (you need to ADD this code to the first frame of the zombie):

_root.zombie_count++;
//this line of code adds 1 to the zombie_count

Why am I writing _root all the time? Because the code is in the zombie, and the variable zombie_count is in the _root, so in order to refer to the zombie_count variable, which I cannot do directly from zombie, I must type _root everywhere. Same with play command. If I just typed play(); inside the zombie, then I would play the zombie, not _root, and by writing _root.play(); I explicitly specify that I intend to play the _root, not the zombie.

Now, the final (again, for programmers all problems are always final lol, cause they forget what they had to do and they write code faster than they think) problem is making the next wave. To do this, you can either manually tween zombies again, or you can replay the entire game from a certain frame.
So let's say after the last wave you make a frame with code:

gotoAndPlay(4);

And the game will rewind from that frame, repeating endlessly.

I was thinking very hard, but it is not possible to make a solution for this which does not involve code, or involves very little (and simple) code, at least simpler than this, so sorry if I've just squeezed your brain too tight and you got a headache.

At 11/13/13 07:50 PM, bambuy wrote:
But for some reason when i place the next zombies on, at the tween etc...

Tweens only work on 1 symbol per layer.

they dont enter the stage when i preview the game.

If you were using a tween, they would not enter even in the Flash IDE, let alone SWF.

Everything else works fine, the background continues to play etc but the next set of zombies wont show up!!!

So the first set of zombies shows up properly, only the next sets are not appearing?

*all caps panicking*

First of all, using a tween to make a game is a horrible idea, but it is possible. So we're going to continue using tweens, so that you do not advance in knowledge/experience faster than your intellect allows.
After you spawn zombies, you must wait until the player kills them, so you must put a stop() command on the main timeline. Not just a stop command, you must also check how many zombies you have, and if 0, then you advance further.

if(zombie_count!=0){
//if zombie_count does not equal 0 then do this
stop();
}else{
play();
}

The problem right now is that zombie_count is not defined anywhere in the game. So you must define zombie_count on the first frame of the main timeline by using code:

zombie_count=0;

Then, inside the zombie, when you remove it, you must ADD this code to the last frame (where you remove the zombie) of the zombie's timeline:

_root.zombie_count--;
//one zombie died, so we decrease the zombie_count by 1
if(_root.zombie_count==0){
//if zombie_count is 0, then resume the game onto the next wave of zombies
_root.play();
}

Now the final problem is that zombie count is never increased. Very simple: increase the zombie count on the first frame of the zombie, where you have a stop command (you need to ADD this code to the first frame of the zombie):

_root.zombie_count++;
//this line of code adds 1 to the zombie_count

Why am I writing _root all the time? Because the code is in the zombie, and the variable zombie_count is in the _root, so in order to refer to the zombie_count variable, which I cannot do directly from zombie, I must type _root everywhere. Same with play command. If I just typed play(); inside the zombie, then I would play the zombie, not _root, and by writing _root.play(); I explicitly specify that I intend to play the _root, not the zombie.

Now, the final (again, for programmers all problems are always final lol, cause they forget what they had to do and they write code faster than they think) problem is making the next wave. To do this, you can either manually tween zombies again, or you can replay the entire game from a certain frame.
So let's say after the last wave you make a frame with code:

gotoAndPlay(4);

And the game will rewind from that frame, repeating endlessly.

I was thinking very hard, but it is not possible to make a solution for this which does not involve code, or involves very little (and simple) code, at least simpler than this, so sorry if I've just squeezed your brain too tight and you got a headache.

ok I appreciate this...First off I want to explain a few things so that this code is going to work before I try it out.
I'm only using tweens as the assignment says we have to use skills we have learned and the lecturer told me to use a tween to move them into the stage.
Next, the new zombie will be on a seperate layer.
The first 2 zombies that enter are each on a seperate layer, each of them look different and each of them are an individual .png as I dont like drawing in flash.
Next, the new zombies that will enter will all look different, be a new .png on a new layer. I only use the tween to move them from off stage to the stage.
So it's not a situation where the same zombies just keep 're spawning' instead it's a new layer with new zombies. So I imported my lets call it zombie 3 onto a new layer, placed it's first key frame off stage, placed it's next keyframe on the stage and used a tween to have it move from off stage to on stage-same as I did for zombie 1 and zombie 2-both individual .png's.
So with this information, do you still believe this code is necessary?

btw, the zombie 1 and zombie 2 pngs both on seperate layers enter at the same time, they appear on the first frame of the main timeline off stage and tween onto the stage. Both work.
The only difference to zombie 3....etc is that it enters the main timeline further along. But it does not show up on preview despite it working when I am in 'work mode' in flash.
So the way I imagined it in my head was that if the person didn't shoot the initial 2 zombies then the rest of the zombie pngs would just pile up on stage....And I couldn't care less about that!!!!

I have no issue using code, as I say I use code in order things like HTML etc but I'm simply new to flash and literally the only thing I have learned in class is tweens so anything else I have been attempting to learn by myself.
Appreciate the help.