Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Tiled graphics problem

This thread is locked; no one can reply to it. rss feed Print
Tiled graphics problem
Lamboo
Member #15,469
January 2014

So, i'm a newbie in game development and i'm making a terraria clone, everything looks great except the tiles.

Its showing strange horizontal lines between the tiles, but only when i center the camera on player, and vertical lines when i'm moving the player, but only whe the camera is locked on player and moving together with it and it occurs like every 5 seconds.

This is the camera function:

void camera(void)
{
al_identity_transform(&trans);
al_translate_transform(&trans, cameraPos[0], cameraPos[1]);
al_use_transform(&trans);
}

Do you guys have any idea what can it be? Thanks in advance and sorry for my bad english. :-[

{"name":"608267","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/7\/57c34503acb49c30b89a4cacc561a228.png","w":1100,"h":650,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/5\/7\/57c34503acb49c30b89a4cacc561a228"}608267

{"name":"608266","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/4\/4418954500038017ccd6ae2e12d4b201.png","w":1096,"h":650,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/4\/4\/4418954500038017ccd6ae2e12d4b201"}608266

Elias
Member #358
May 2000

What if you do this:

al_translate_transform(&trans, floor(cameraPos[0]), floor(cameraPos[1]));

--
"Either help out or stop whining" - Evert

Lamboo
Member #15,469
January 2014

It worked :o thank you so much Elias ;D

edit
Today, i just realized that when the player is moving, its sprite keeps shaking 1 pixel + and 1 pixel -. Without the floor() function it doesn't happen.

Help :-/

Elias
Member #358
May 2000

How do you draw the player? Either add a floor() to where you draw the player as well, or draw the player without the transform.

--
"Either help out or stop whining" - Evert

Lamboo
Member #15,469
January 2014

Thank you for reply, i thought about it and had the idea of making a new camera without floor(), just for the player, and it worked. 8-)

Thank you so much ;D

Go to: