2
왼쪽에서 오른쪽으로 스크롤되는 구름이 있습니다. OrthographicCamera를 사용하고 있습니다. 나는 그들이 왼쪽에서 오른쪽으로가 아니라 화면쪽으로 움직 이도록하기 위해이 구름들을 어떻게 조정할 것인가에 대해 궁금해하고있었습니다. Orthographic 카메라를 사용해도됩니까? 내가 어떻게 할까? 정의 저장소로사이드 스크롤링 구름
public void create() {
sky = new SkyFlux();
//getting the height and width for setup purposes
float w = Gdx.graphics.getWidth();
float h = Gdx.graphics.getHeight();
//setting up camera and batch
camera = new OrthographicCamera(1, h/w);
//setting up sky
for(Texture texture:sky.getTexture())
textures.add(texture);
//Adding the sky related sprites
for(Sprite sprite:sky.getSprite())
skySprites.add(sprite);
}
public void render() {
//clearing everything out
Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
time += Gdx.graphics.getDeltaTime();
if(time > 1.0f)
time = 0.0f;
float speed = 1.0f;
//Adjusting the speed of the sprites except the first sprite which is the base image.
for(int i=1;i<skySprites.size();i++) {
skySprites.get(i).setV(time+speed);
skySprites.get(i).setV2(time);
speed = speed+1.0f;
}
//setting up
batch.setProjectionMatrix(camera.combined);
//begging draw
batch.begin();
//items to be drawn
//TODO: add other items to be drawn here
for(Sprite sprite:skySprites)
sprite.draw(batch);
//ending draw
batch.end();
}
흠, 확인. 어떤 카메라 유형을 제안 하시겠습니까? ProjectionViewportCamera? 아이소 메트릭? 또는 원근법? – BigBug
ProjectionViewportCamera와 함께'libgdx'를 사용했습니다. (연기 퍼프와 같은 최소한의 3D 요소를 가진 2D 게임에서도) 쉽게 제안 할 수 있습니다. –
괜찮습니다. 감사 – BigBug