function UserControl() {}
UserControl.onKeyUp = function() {
var code = Key.getCode();
var mkey1="S";
var mkey2="D";
var activeKey1=new string(mkey1).charCodeAt(0);
var activeKey2=new string(mkey2).charCodeAt(0);
switch(code) {
/*mermaid
movement start*/
case activeKey1 : //s key
aerial.mermaid("left");
if(aerial._x>150){
aerial._x-=10;
if(aerial._x>350 && aerial._x<500){
aerial.mermaid("leftlove");
}
}
break;
case activeKey2 : //d key
aerial.mermaid("right");
if(aerial._x<680){
aerial._x+=10;
if(aerial._x>350 && aerial._x<500){
aerial.mermaid("rightlove");
}
}
break;
/*fish
movement start*/
case Key.LEFT :
tony.changedirection("l");
if (tony._x>25){
tony._x-=10;
tony._xscale*=.95;
tony._yscale*=.95;
tony._alpha+=1;
}
break;
case Key.RIGHT :
tony.changedirection("r");
if (tony._x<615){
tony._x+=10;
tony._xscale*=1.05;
tony._yscale*=1.05;
tony._alpha-=1;
}
break;
case Key.UP :
tony.changedirection("do");
if (tony._y>10){
tony._y-=10;
tony._xscale*=.95;
tony._yscale*=.95;
tony._alpha+=1;
}
break;
case Key.DOWN :
tony.changedirection("u");
if (tony._y<375){
tony._y+=10;
tony._xscale*=1.05;
tony._yscale*=1.05;
tony._alpha-=1;
}
break;
/*background
movement start*/
case Key.SPACE :
bgout.startAction();
break;
}
};
Key.addListener(UserControl);
|