我正试着做这件事:
当用户按一次键时,精灵在某些像素上平滑移动.但它只是"传送"到这个位置.这是代码:
int co = 0;
Vector2 ppos=new Vector2(x,y);
if (Gdx.input.isKeyJustPressed(Keys.A)){
while (co < 33) {
batch.begin();
ppos.y += Gdx.graphics.getDeltaTime()*5;
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.draw(Splayer, ppos.x, ppos.y); //Splayer is a sprite
batch.end();
co++;
out(co+"");
}
}
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?