PDA

View Full Version : Duplicating and Keeping Count


Kingslayer
05-02-2008, 06:12 PM
Hey i just started up and got 2 Objects now

Nr.1 is

onClipEvent (load) {
Speed = 10;
Step = 50;
Count=0
Rotate=20
}
onClipEvent (enterFrame) {
_rotation+=Rotate
_x += Speed;
_y -= (_y-_root.Spaceship._y)/Step;
if (_x>Stage.width+_width) {
_x = -_width;
_y = Math.random()*Stage.height;
this.duplicateMovieClip('Asteroid'+Count, _root.getNextHighestDepth());
_root['Asteroid'+Count]._y = Math.random()*Stage.height;
_root['Asteroid'+Count]._x = -_width-Math.random()*Stage.width/10;
if(Step>0)Step--
Speed++
Count++
trace(Count)
}
if (this.hitTest(_root.Spaceship)) {
trace('Hit');
}
}


Nr.2 is

onClipEvent (load) {
startDrag(this,true)
Mouse.hide()
}
onClipEvent (enterFrame) {
}



My Problem is i wanted Object Nr.1 to Clone itself everytime it reloads but it should add only 1 Copy, right no its goin 1,2,4,8... and so on i want it to go 1,2,3 Because of that also i cant use Count++ to keep count because a knew object sets its own count always to one so i thought it would be good to have another object that keeps count of how many objects i have. Would be nice if u could post em an example.