This is the code from the original Jump program:
Red.addEventListener(MouseEvent.CLICK, RedJump);
function RedJump(event:MouseEvent):void
{
Green.x -= 60;
}
Blue.addEventListener(MouseEvent.CLICK, BlueJump);
function BlueJump(event:MouseEvent):void
{
Green.x +=60;
}
Yellow.addEventListener(MouseEvent.CLICK, YellowJump);
function YellowJump(event:MouseEvent):void
{
Green.y +=60;
}
Orange.addEventListener(MouseEvent.CLICK, OrangeJump);
function OrangeJump(event:MouseEvent):void
{
Green.y -= 60;
}
In my new folder for the project, I have created five .as files which will house the code: MoveLeft, MoveRight, MoveUp and MoveDown for each of the buttons, and Jump for the main body of the program.
No comments:
Post a Comment