I learn a dragon shooting game from Kirupa. I want to unload the dragons but the dragons run to the corner, need help from the expert.
This is the script:
var dragons:Number = 2;
var i:Number = 0;
var score:Number = 0;
function initDragons() {
for (i; i<dragons; i++) {
attachMovie(“dragon”, “dragon”+i, i);
dragon = _root[“dragon”+i];
updateDragons(dragon);
dragon.onEnterFrame = function() {
if (this._x>0) {
this._x -= this.velo;
} else {
updateDragons(this);
}
};
}
}
initDragons();
function updateDragons(which) {
which._x = random(100)+530;
which._y = random(80)+80;
which.velo = random(10)+2;
}
on (press) {unloadMovie(“dragon”);updateDragons(this);
}