Hello,
I am trying to get view in my game like this:
http://upload.wikimedia.org/wikipedia/en/6/6f/Double_Dragon_3_for_NES_screenshot.png
Should i use perspective camera or it is possible to do it with orthographic camera? Do you have any idea how to do that?
My idea was to do it in this way
Texture texture;
OrthographicCamera cam;
SpriteBatch batch;
final Sprite[][] sprites = new Sprite[10][10];
final Matrix4 matrix = new Matrix4();
final Matrix4 matrix2 = new Matrix4();
Sprite bucket;
public GameScreen(final SSS game) {
this.game = game;
texture = new Texture(Gdx.files.internal("assets/badlogic.jpg"));
cam = new OrthographicCamera(10, 10 * (Gdx.graphics.getHeight() / (float)Gdx.graphics.getWidth()));
cam.position.set(5, 5, 10);
cam.direction.set(-2, -2, 0);
cam.near = 1;
cam.far = 100;
matrix.setToRotation(new Vector3(1, 0, 0), 90);
for(int z = 0; z < 10; z++) {
for(int x = 0; x < 10; x++) {
sprites[x][z] = new Sprite(texture);
sprites[x][z].setPosition(x,z);
sprites[x][z].setSize(1, 1);
}
}
batch = new SpriteBatch();
Gdx.input.setInputProcessor(this);
matrix2.setToRotation(new Vector3(0, 1, 0), 90);
bucket = new Sprite( new Texture(Gdx.files.internal("assets/bucket.png")));
bucket.setPosition(-5, -5);
bucket.setSize(1, 1);
}
@Override
public void render(float delta) {
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
cam.update();
batch.setProjectionMatrix(cam.combined);
batch.setTransformMatrix(matrix);
batch.begin();
for(int z = 0; z < 10; z++) {
for(int x = 0; x < 10; x++) {
sprites[x][z].draw(batch);
}
}
batch.end();
batch.setTransformMatrix(matrix2);
batch.begin();
bucket.draw(batch);
batch.end();
}
but that way don’t allow my future character to jump, only to walk.
I’m new to this world sory for my mistakes.
Thanks in advance for help