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

查看:111
本文介绍了为什么我要使用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:

推荐答案

这是因为您需要向图块添加填充.

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天全站免登陆