I am just trying to make a puzzle game similar to the puzzle games based on Shariki(http://en.wikipedia.org/wiki/Shariki).
I am building a library that allows one to create any number of puzzles within a single game. For example, you start out on one screen looking at Puzzle A. By pressing the right or left keys you go to Screen 2 or Screen 3 and see Puzzle B or Puzzle C. Each puzzle can vary in width, height, x, y, number of tiles, size of tiles, size of padding between tiles, etc.
I am still developing the framework, but I have run into this issue that I thought I had fixed a ~month ago.
On a grid of 8 x 8 tiles. Each tile can have a varying 'padding' between it and the tiles surrounding it. This padding can be specified via any number of pixels. The game will scale the tiles to keep the desired board size the same, but increase/decrease this padding.
When I create these puzzle boards, some of the tiles will have no padding, some will have the desired padding, and some will overlap and 'blend' into a darker color.
Desired look:
I've found a way to re-create these lines via resizing the game while it is running:
Linear filter has dark overlapping edges:
I can't add another attachment, but the Nearest filter does not have the dark overlapping edges, but instead contains tiles butting up to other tiles. So even with 'padding' some tiles will be right up against other tiles.
However. I have been working with a size of 480x800 for my game window and camera size. When I vary the number of tiles, the lines show up different times/different places due to automatic resizing of the code.
I have attempted numerous things to fix this:
1. Changing height, width, x position, y position, scaling, etc. from ints to floats and floats to ints.
2. Changing the filters on the textures from Linear<->Nearest.
3. Changing camera types.
4. Changing the SpriteBatch matrices to other things.
I finally created a bare bones application to just draw the pictures above(The full code for the main file is attached in Test.txt). Here is what I think are the major snippets:
- Code: Select all
camera = new OrthographicCamera();
camera.setToOrtho(false, 550, 550);
- Code: Select all
batch = new SpriteBatch();
- Code: Select all
redTexture = new Texture(Gdx.files.internal("data/red.png"));
redTexture.setFilter(TextureFilter.Linear, TextureFilter.Linear);
redSprite = new Sprite(redTexture);
- Code: Select all
sprite.setPosition(x * 65, y * 65);
- Code: Select all
public void render() {
Gdx.gl.glClearColor(1, 1, 1, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
batch.setProjectionMatrix(camera.combined);
batch.begin();
for(Sprite sprite: spriteContainer)
{
sprite.draw(batch);
}
batch.end();
}
There are no other references to cameras, frustrums, views, spriteBatches, etc in the test code. This is it.
Here are a couple references that I tried to use to solve this:
https://github.com/libgdx/libgdx/wiki/O ... hic-camera
http://www.badlogicgames.com/wordpress/?p=1403
http://code.google.com/p/libgdx-users/wiki/Sprites
I'm feeling really frustrated and want this library framework completed.
I don't know much of anything about OpenGL. I can do matrix calculations, but I don't know much about the graphics implementation with matrices.
Any help is appreciated.