为什么我在使用 Tiled 的 libgdx 游戏中出现线条? [英] Why do I have lines going across my libgdx game using Tiled?

查看:28
本文介绍了为什么我在使用 Tiled 的 libgdx 游戏中出现线条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 LibGdx 和 Tiled,当在屏幕上移动时,游戏中同时出现水平线和垂直线.如有必要,我可以发布您需要的任何代码.如何让这些线路停止?

I'm using LibGdx and Tiled and when moving around the screen, there are both horizontal and vertical lines appearing on the game. I can post any code you need, if necessary. How do I get these lines to stop?

这是线条的 gfycat gif:

Here's a gfycat gif of the lines:

http://gfycat.com/FastUnnaturalAmericanwirehair

这是一个小的 bitbucket 存储库,尽可能小,但其中有相同的故障:

Here's a small bitbucket repository, as small as I could get it that has the same glitch in it:

https://bitbucket.org/Chemical_Studios/example-of-line-glitch/src/8eeb153ec02236d836763072611bd7aa55d38495/minimalExample/src/com/weebly/chemicalstudios/minEx/?at=master

推荐答案

这是因为你需要给你的图块添加一个内边距.

This is because you need to add a padding to your tiles.

这是一个很常见的问题,您不是第一个遇到它的人.基本上由于缩放和平移时的舍入误差,有时您会渲染两个图块之间"的区域,这将导致什么都没有渲染 -> 黑色背景颜色通过.

This is a pretty common problem and you are not the first to encounter it. Basically due to rounding errors when scaling and panning around, sometimes you will render the area "between" two tiles, which will result in nothing being rendered -> black background colour comes through.

您基本上需要使用一些工具将填充添加到您的图块集中.在这个 论坛帖子中我解释了怎么做.

You basically need to use some tools to add the padding to your tileset. In this forum thread I explained how to do it.

还有一个关于stackoverflow的问题这里.

There is also one more questions regarding this topic on stackoverflow here.

这篇关于为什么我在使用 Tiled 的 libgdx 游戏中出现线条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆