Shooting Game Missile Flaw
I'm making a Space Invaders-type game. Y'know? Arrow keys to fly Space to shoot? Well, shooting isn't working so well. I have two .as files: Ship.as which controls the ship's ActionScript, and Missile.as which is supposed to control the missile. When I hit load it up I get the error: The class or interface 'Missile' could not be loaded.
Shooting Game Missile Flaw
I'm making a Space Invaders-type game. Y'know? Arrow keys to fly Space to shoot? Well, shooting isn't working so well. I have two .as files: Ship.as which controls the ship's ActionScript, and Missile.as which is supposed to control the missile. When I hit load it up I get the error: The class or interface 'Missile' could not be loaded. When I press spacebar, the missile appears and just sits there on the stage doing nothing.
Here's the missile ActionScript:
Actionscript Code:
class Missile extends MovieClip
{
var speed;
function onLoad()
{
speed = 20;
}
function.onEnterFrame()
{
_x += speed;
if(_x > 600)
{
this.removeMovieClip();
}
}
}
...and here's the ship ActionScript:
Actionscript Code:
class Ship extends MovieClip
{
var velocity;
var shootLimiter;
function onLoad()
{
velocity = 10;
shootLimiter = 0;
}
function onEnterFrame()
{
shootLimiter += 1;
if( Key.isDown(Key.LEFT) ){ _x -= velocity; }
if( Key.isDown(Key.RIGHT) ){ _x += velocity; }
if(Key.isDown(Key.UP) ){ _y -= velocity; }
if( Key.isDown(Key.DOWN) ){ _y += velocity; }
if( Key.isDown(Key.SPACE) && shootLimiter > 8)
{
shootLimiter = 0;
var missile = _root.attachMovie("Missile","Missile" + _root.getNextHighestDepth(), _root.getNextHighestDepth());
missile._x = _x + 50;
missile._y = _y + 2;
}
}
}
Please help, I've been trying to figure this out for days. >_<;