我一直在製作一個遊戲,其中有負數的對象數爲負數,我已經拿到了數組列表,而我正在向下移動主角。但是當與對象不動的爲time.The代碼一些時間後光滑,他們所得到的抽搐字符的攝像機移動是繼在向下移動相機時出現顛簸的物體
@Override
public void create() {
camera = new OrthographicCamera(480, 720);
camera.position.set(480/2, 720/2, 0);
batch = new SpriteBatch();
int i;
this.baloonArrList = new ArrayList<Baloon>();
for (i = 0; i < 3000; i += 300) {
Baloon baloon = new Baloon(200, i);
baloonArrList.add(baloon);
System.out.println(baloon.balloon_y);
}
texture1 = new Texture(Gdx.files.internal("data/sheet_final.png"));
textureRegion1 = new TextureRegion(texture1, 561, 156, 115, 101);
}
@Override
public void render() {
GLCommon gl = Gdx.gl;
Gdx.gl.glClearColor(1, 1, 1, 1);
gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
camera.position.y += 4;
camera.update();
batch.setProjectionMatrix(camera.combined);
batch.begin();
int len = baloonArrList.size();
for (int i = 0; i < len; i++) {
batch.draw(textureRegion1, baloonArrList.get(i).balloon_x,
baloonArrList.get(i).balloon_y, 100, 100);
}
batch.end();
}
所以,我怎樣才能使物體的運動順暢。
問題是否出現在Android,桌面或兩者上? – 2013-03-18 09:07:16
@RodHyde它們都來了。 – 2013-03-18 09:24:02