View Full Version : Duplicate Movie Clips?
SChaput
02-19-2008, 06:34 PM
I am trying to create a movie where a movieclip appears at random on screen and tweens across. I am using the tutorial found here (http://www.actionscript.org/resource...ts/Page1.html). I am able to get the image to appear and move across the screen, once a button is pressed. However, i have realized that if the button is not pressed within a few seconds of the movie loading, the movie clip does not duplicate.
I'd really appreciate any help i could get.
Thanks.
Engine to create random movie clips
onClipEvent (enterFrame) {
_root.top1.play();
_root.bottom1.play();
totalNum=200;
if (_root.delay) {
if (Math.floor(getTimer()/1000) == _root.lastTime+1) {
_root.delay = true;
}
} else if (Math.floor(getTimer()/1000) == _root.lastTime+_root.wait)
{
_root.lastTime = Math.floor(getTimer()/1000);
_root.delay = false;
// custom actions begin
_root.count = _root.count+1;
if (_root.count <= totalNum) {
duplicateMovieClip("_root.clip", "clip"+_root.count, _root.count);
_root["clip"+_root.count]._y = random(350)+50;
}
// custom actions end
}
}
On another frame, _root.wait=2
BLiZZaRD
02-19-2008, 07:48 PM
duplicateMovieClip("_root.clip", "clip"+_root.count, _root.count);
The red section is the level, higher numbers get placed higher on the stage. this can either be removed completely, or use a static number or getNextHighestDepth();
Another problem (and I apologize for my "shots in the dark" here but I haven't been in a Flash frame of mind for a couple weeks and I am getting rusty) is you are trying to duplicate a movie clip and your function does it when the clip enters the frame.
Since this is done on a button press, try changing the
onClipEvent (enterFrame) {
to
onClipEvent (load) {
SChaput
02-19-2008, 08:37 PM
I changed the clip event to on load and the same thing still happened.
I tried attaching the .fla to this post however i guess i can not do that. I have provided the source here,
http://www.home.southernct.edu/~chaputs1/bud2.fla
--
Please excuse the context of the game, haha.
Thank you Blizzard, that is the first response i have gotten on many fourms.
---
Also, i have tried to work out the leveling but i am not sure what is happening, i would need the duplicated movie to appear on the utmost bottom layer and whenever i change the number to, 1,2,3 or anything it makes the image appear randomly however it only moves half way across the screen. :/
BLiZZaRD
02-20-2008, 03:32 PM
I will take a look as soon as things slow down at work here today, will try to get back to you ASAP.
SChaput
02-20-2008, 06:58 PM
Thank you.
I have also been working on a timer, which i got to work however it starts the beginning of the movie and not at the start of the game itself, if you have time to show me how to do that id appreciate it, if not, im sure i can find a tutorial or something.
Thanks again.
BLiZZaRD
02-20-2008, 07:06 PM
Is the timer in the download already? I downloaded it before I made my post above, check my post time. If you have added it after, please reupload and link again.
It is looking more and more like I will have to wait til I get home from work today (about 4 more hours) But I will check it out.
SChaput
02-20-2008, 07:27 PM
Yes the timer is already in the flash file.
Everything is there to make it work i believe, my only concern is it might be unorganized and may be hard to decipher haha.
BLiZZaRD
02-22-2008, 11:00 PM
Okay, I am looking at this, and you do have things all over the place. If you give me a couple days I can rework some of the more major problems.
For instance you have 2 MCs (so far) that have the same name.. not good for AS, you also have if statements not == to anything.
I have a few projects ahead of this though so I would need time. If you are in a hurry there is always the purchase plan ;)
If there is anything specific I need to know about it tell me here and I will make sure it gets worked in.
SChaput
02-22-2008, 11:35 PM
yea i tried to make it in a haste and am a naturally unorganized person haha. Uh...the only other thing i was planning on adding was something that saved a persons personal high score, however i think that is something that i need to use databases for so that may be far down the road, haha.
I really appreciate any time you can spend working on this, thank you.
BLiZZaRD
02-24-2008, 04:24 PM
Just to verify...
You have the "hero" able to move as it does with a gravitational force in effect. You have the "baddies" coming cross screen in multiples, at random.
No health.. one hit kill (no pun intended) and same goes for top and bottom borders.
The timer should start on game start and this is also the score, higher is better.
Integrate a high score system for the various players to compete against each other this way.
Did I miss anything?
Going through it again, if this is all there is to it, you have a TON of stuff in there that is not needed at all.
If, on the other hand I missed something, please let me know. :D This is quite fun. Even though most of my projects are games, I haven't coded a game in ages. Been working mainly on apps and proggies.
SChaput
02-24-2008, 10:39 PM
haha well i was thinking of also making the top and bottom walls show something to make the illusion that the 'hero' is moving forward and not in a static place going up and down. I am not sure exactly how to accomplish this if you have any suggestions id love to hear them.
besides that the idea you ran down sounds perfect. I was unaware i had things that i didnt even need but i guess that means there was no way i was going to finish this without help.
Im glad to hear your having fun as all im encountering is frustration, haha. I have many projects that i make alot of, get to one thing that i can not tackle and give up, id really like this to be different, even if im not behind the coding, haha.
BLiZZaRD
02-25-2008, 03:22 PM
Moving walls.. added. Okay.
I will keep you inthe coding loop as well ;) Then you will learn something and can do it on your own next time :D
By the way.. which version of Flash are you using?
SChaput
02-25-2008, 04:08 PM
Yea id love to be updated im really interested to see how it all comes together in working order.
I belive i am using Flash 8 Professional. I am not 100% sure because i am in class right now but i will get back to you in a few hours.
BLiZZaRD
02-25-2008, 04:39 PM
Okay. it doesn't matter really I have 4 versions here, just wanted to code in the one you are using for ease of transfer.
Because I am on a Linux box, you will most likely have to redo the fonts, but hopefully that is all you will need to do, that and read the comments I put in there so you can learn. :D
SChaput
02-25-2008, 11:40 PM
Yup i am in flash 8 pro.
ive been fiddling with it alot seeing what i can do and can not do but am experiencing lag every few seconds. At first i thought it was the game but then i realized it happened for all flash items so I came to the conclusion it was my schools "less than par" internet. Haha.
SChaput
03-12-2008, 12:07 AM
Hey, just wondering how everything is going.
thanks.
BLiZZaRD
03-14-2008, 04:21 AM
Still have it, my computer tore through a PSU and I had to get a new one, that took a bit as I don't have much $$ :)
I will get it back to the top of my list ASAP. Sorry for the delays.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.