Hi, I’m pretty new to flash, and I have to create this game for my digital imaging class. So far, I have the code below, but there are some problems I’ve encountered. The enemies need to fall from the top of the screen randomly. I also want to change the speed of the enemies to make them fall faster and in greater quantity. Lastly, I am trying to make a different scene with a separate enemy coming from the top, but every time I change the name in the parentheses to the instance name of the new enemy, it remains the same! Any help would be amazing! Thanks.
shanemc._x = 1;
onEnterFrame = function() {
shanemc._x = shanemc._x + 0;
if(shanemc._x > 500){
shanemc._x = 0;
}
if(shanemc._x < 0){
shanemc._x = 500;
}
if (Key.isDown(Key.RIGHT)) {
shanemc._x += 8;
}
if (Key.isDown(Key.LEFT)) {
shanemc._x -= 8;
}
var enemyStartPoint = Stage.height+400;
var enemyEndPoint = 0;
for(var i=0; i<enemyCount; i++)
{
var enemy:MovieClip = _root.attachMovie("enemy", "enemy"+i, i);
enemy._y = enemyStartPoint;
enemy._x = Math.random()*Stage.width;
enemy.enemySpeed = Math.floor(Math.random()*3)+2;
enemy.onEnterFrame = moveEnemy;
}
function moveEnemy()
{
this._y -= this.enemySpeed;
if(this._y < enemyEndPoint)
{
delete this.enterFrame;
this._y = enemyStartPoint;
this._x = Math.random()*Stage.width;
}
}
}