Im building a new game, the idea is you collect things which fall from the top with your mouse, and when you touch them, it attach’s a fading movieclip. I have done rpetty much this:
http://u1.imgupload.co.uk/1250463600/8727_lol.swfOn the falling Items I have this:
onClipEvent (load) {
function reset() {
this._visible = true;
this._x=random(50);
this._y=random(0);
fallspeed=0.1;
}
reset();
}
onClipEvent (enterFrame) {
gravity=0.1;
fallspeed += gravity;
this._y+=fallspeed;
if (_y > 545) {
reset();
}
}
onClipEvent (enterFrame) {
if(_root.five.hitTest(_root.cursor)){
xvar = this._x
yvar = this. _y
_root.attachMovie("Bomb", "Fiveexploasion", 1, {_x:xvar, _y:yvar});
_root.gold += 5
this._visible = false;
this.gotoAndPlay(2);
reset();
}
}
The bit to look at, I hope, is this:
onClipEvent (enterFrame) {
if(_root.five.hitTest(_root.cursor)){
xvar = this._x
yvar = this. _y
_root.attachMovie("Bomb", explosion", 1, {_x:xvar, _y:yvar});
_root.gold += 5
this._visible = false;
reset();
}
}
So if it falls down, it spawns back up, if your mouse hits it, it disspears with the explosion/fading “bomb” mc in its place.
The problem:
If I hit one, and it starts to fade, and then hit another, before the prevoius one has faded, then, annoyingly, the previous fade disspears and restarts at the new one I just hit.
Im looking for a way to avoid this, I was thinking of Duplicating the movieclip, but I cant find a way for it to work.
Im also looking for a way to, spawn them activily randomly, so more than one on the screen at a time. Im not sure how to do this, so could I please get some help!
If you find me a way, I shall put you in the credits!
Thank you!