Scank
April 2nd, 2008, 01:13 PM
Hi, Im following a simple tutorial for creating a spacegame, simple game where a space ship shoots bullets and hits objects, using keyboard input... I have the following script, which makes the object move around the stage...
this.onEnterFrame = function()
{
if (Key.isDown(Key.RIGHT))
{
Ship._x += 10;
} else if (Key.isDown(Key.LEFT))
{
Ship._x -= 10;
} else if (Key.isDown(Key.UP))
{
Ship._y -= 10;
} else if (Key.isDown(Key.DOWN))
{
Ship._y += 10;
}
}
Now Im doing this for a University assignment, and a reqwuirement is it needs to use AS3! Well when i run the application in AS3 it does not recognise the UP DOWN RIGHT and LEFT values...however, it does run fine using AS2..is there anyway i can incorporate this script into AS3? Thanks.
this.onEnterFrame = function()
{
if (Key.isDown(Key.RIGHT))
{
Ship._x += 10;
} else if (Key.isDown(Key.LEFT))
{
Ship._x -= 10;
} else if (Key.isDown(Key.UP))
{
Ship._y -= 10;
} else if (Key.isDown(Key.DOWN))
{
Ship._y += 10;
}
}
Now Im doing this for a University assignment, and a reqwuirement is it needs to use AS3! Well when i run the application in AS3 it does not recognise the UP DOWN RIGHT and LEFT values...however, it does run fine using AS2..is there anyway i can incorporate this script into AS3? Thanks.