代吗的问题

时间:2008-06-19 05:33:30   来源:论坛整理  作者:  编辑:chinaitzhe
求教,这段代码,哪里有问题

public void run() {
while (true) {
long timestart = System.currentTimeMillis();
if (x != -48) {
x -= 24;
} else {
x = 0;
}
try {
Thread.sleep(200);

} catch (Exception e) {
e.printStackTrace();
}

if (keystate[0]) {
if (clipx <= 0) {
clipx = 0;
} else {
y = -32;
clipx -= 5;

}
}
if (keystate[1]) {
y = -64;
clipx = 5;

}
if (keystate[2]) {
y = -96;
clipy -= 5;
}
if (keystate[3]) {
y = 0;
clipy = 5;

}

render();
repaint();
long now = System.currentTimeMillis();
try {
if ((now - timestart) < 100) {
Thread.sleep(100 - (now - timestart));
}
} catch (Exception e) {
e.printStackTrace();
}
}
}


}
网友回复:你用这个代码碰到了什么问题嘛??
网友回复:人物移动出现了问题
网友回复:这样问问题也太简单了吧
网友回复:楼上两头牛,真搞笑
关键字:问题,

文章评论

共有 0 位网友发表了评论 此处只显示部分留言 点击查看完整评论页面