public class DirectionKeyMove
{
/*定义boolean变量**/
private boolean ok = false;
/**定义方向键的位置*/
int aspectX, aspectY;
public DirectionKeyMove(int x,int y)
{
aspectX = x;
aspectY = y;
}
public void upMove()
{
while(aspectX == 150)
{
aspectY --;
if(aspectY == 0)
{
break;
}
}
System.out.println(aspectY);
}
public void leftMove()
{
while(ok)
{
aspectY --;
System.out.println(aspectY);
if(aspectY == 0)
{
break;
}
}
}
public void downMove()
{
while(ok)
{
aspectY --;
if(aspectX == 0)
{
break;
}
}
}
public void rightMove()
{
while(ok)
{
aspectY --;
if(aspectX == 0)
{
break;
}
}
}
}
是条件错了,但是不看其他的代码不容易看~
[此贴子已经被作者于2007-2-1 15:03:23编辑过]