I cannot get my enemy ships to disappear when they come in contact with the ship. Currently my ship and enemy ship have different names than their AS Linkage, but the AS linkage names are ship and enemyship. Originally I was having difficulty with the AS working so the names are in all lower case throughout the files. As for the ActionScript pages themselves..
class enemyship extends MovieClip
{
var speed;
function onLoad()
{
_x = 650;
_y = Math.random()250 + 50;
speed = Math.random()5 + 5;
}
function onEnterFrame()
{
x -= speed;
if(x < -100)
{
this.removeMovieClip();
}
if(this.hitTest(_root.ship))
{
explode();
}
function explode()
{
this.removeMovieClip();
}
}
}
and the ship’s
class ship extends MovieClip
{
var velocity;
var shootLimiter;
var enemyTimer;
function onLoad()
{
velocity = 10;
shootLimiter = 0;
enemyTimer = 0;
}
function onEnterFrame()
{
shootLimiter += 1;
if( Key.isDown(Key.RIGHT) )
{ _x = _x + velocity; }
if( Key.isDown(Key.LEFT) )
{ _x = _x – velocity; }
if( Key.isDown(Key.UP) )
{ _y = _y – velocity; }
if( Key.isDown(Key.DOWN) )
{ _y = _y + velocity; }
if( Key.isDown(Key.SPACE) && shootLimiter > 8)
{
shootLimiter = 0;
var missile = _root.attachMovie( “missile” , “missile” + _root.getNextHighestDepth() , root.getNextHighestDepth() );
missile.x = x + 100;
missile.y = _y -102;
}
enemyTimer += 1;
if(enemyTimer > 80)
{
enemyTimer = 0;
root.attachMovie(“enemyship”, “enemyship” +root.getNextHighestDepth(), _root.getNextHighestDepth());
}
}
}
Help would really be appreciated!