Seriously, I need help with a game but I don’t know what “genre” it is known as. Its a very common and basic game, and I’ve tried to find tutorials on it but I dont really know what to search for…
The game is like this, a movie clip keeps duplicating on screen and you have to click on it. If you do, your score increases… if you dont, the movieclip stays on screen for a few seconds and then goes away so you loose a point…also, the more points you get, the faster the movie clip duplicates… i hope i made myself clear… if there are such tutorials on this site, i’d be happy if someone could simply point me in the right direction…
thanks a lot!
-_- you should start slow…you dont even know the basics and you are trying to leap to a project.
Anyway, are you using as2 or as3? in either case lookup in the help file on(Press) and onMouseDown. If you still dont get it, provide a visual image of how you want it(the gameplay) to look like and i will make you a basic example.
Oh, and this type of games belong to “arcade” genre!
I got the movieclip to keep duplicating itself at an interval which gets shorter and shorter and time goes on… now i’m stuck with two new problems…
-
The movieclip has to unload itself after it finishes playing, and it works for all instances except the first one… u have to see the fla to see what i mean…
-
when i drag the movie clip to the green box, the score should go up a point and also unload that movie clip
I’m really stuck on this and I remember now that I was stuck on the removing movie clip codes the last time I made a game too… Can anyone please help me out? I’m attaching the zip fla… thanks a lot!
okayso i got unexpected file as well in flash mx 2004 but anyways the first object mi guessing your originak should be off the stage and have your randomizing code in it so that all of your duplicates will have to the same code and to save processing if you dont want the original moving use
if(this._name!=‘instancename’){
//your code will only activate the items other than your original here;
}
hope that helps.
I’ve been working on it and after a good nights sleep I managed to solve the lil problem. Instead of duplicating an existing movieclip on stage, I wrote a loop to keep attaching the mc directly from the library. I think this method is much better for the reasons…
-
It is cleaner and you dont need to start the movie with a movie clip in it, in or out of the screen.
-
Each attached movie gets a unique name and none of them get mixed up with each other as was what was happening before with the duplicate function.
NOW!!! Another problem and I really cant tell why?! Seems to be a problem with the score system… The score doesnt increase when the mc is dropped over the box… but it traces a hit… hmmm… wierd…
Have a look at if you like, and any help will be a pleasure!
I’ll be sure to post the whole fla after I succesfully complete is so if anyone’s been following this thread, you’ll have the entire prototype at the end…
Until then, here’s what I got so far… any help? (I’m now uploading a Flash 8 FLA)
ok so im still getting an error in the opening but at home i only have flash mx ill try tommorow on a better computer but anyways is [U]all[/U] of your code in one place or does it have a few spots that have your major chunks? because if your calling your hittest in another place than where your defining your score youll have to make your score a global variable.
Hey guys, thanks for the help… I’ve solved it…
Cooldude, you were right about the global variable… I think thats why it wasn’t working… I didn’t really understand “global variables” so for now I just put the hittest in the same place where I initialized the score (Actions Layer).
The butt_mc has the stop and start drag codes… Also, at the end of the animation, there’s the code to reduce the score and the code to remove the movie clip…
Here’s the finished FLA. Hope you guys can use it somehow!
Just to wrap this up nice and properly, the error which I was facing before wasn’t because of the global variable problem. It’s because I was using an old script, AS2.0 but the code was in 1.0. The mistake is basically this code…
if (this._parent._droptarget == “/green_box”)
That is a AS 1.0 code. I was looking up a really old drag and drop tutorial when I found this code. The code should be the following:
if (eval(this._droptarget) == green_box)
Hope this cleared up any doubts…
P.S. The drag and drop codes should be on the Butt_mc/dragger
The problem is you are trying to increase the score after the movie clip is removed, thus, the increasing is never executed, because the movie clip which would do that has just been removed.
This is the current code:
if (this._parent._droptarget == "/green_box") {
trace ("Hit ");
this._parent.removeMovieClip();
_root.score = _root.score + 100;
}
And the fixed one:
if (this._parent._droptarget == "/green_box") {
_root.score += 100;
trace ("Hit ");
this._parent.removeMovieClip();
}
The “Hit” is traced because it is done before removing the movie. Note that anything that comes after the line “this._parent.removeMovieClip();” will just be ignored, as the move is removed and stops executing commands.
Also, note that, in the long run, you can save a lot of typing and have a clearer code if you use:
anyVariable += anyValue;
instead of:
anyVariable = anyVariable + anyValue;
This works for any operation (+=, -=, *=, etc)