简体   繁体   English

平铺的Java和视差

[英]Tiled Java & Parallax

Does anyone know how the provisional support for parallax layers in the GitHub Java version of Tiled works properly? 有谁知道GitHub Java版Tiled中对视差图层的临时支持如何正常工作?

It compiles, and it executes fine. 它编译,并且执行良好。 However, if I set a layer to viewplane distance 0.00 (the minimum) and the eye-viewplace distance to 0.00, I would expect the yellow rectangle which represents the game's viewport to scroll 1:1 with the editor view. 但是,如果将图层的viewplane distance设置为0.00(最小),并且将eye-viewplace distance为0.00,则我希望代表游戏视口的黄色矩形与编辑器视图一起滚动1:1。 It does not, and scrolling all the way to the left of the editor view results in the yellow 'viewport' rectangle being half off of the screen. 不会,并且一直滚动到编辑器视图的左侧会导致黄色的“视口”矩形偏离屏幕一半。

Am I misunderstanding the tool, or is it not in a working state? 我是否误解了该工具,或者它不是处于工作状态? If I can understand it, then extending Slick2D's TiledMap class to render the layers with parallax depth should be trivial. 如果我能理解的话,那么扩展Slick2D的TiledMap类以渲染具有视差深度的图层应该很简单。

Upon closer inspection of the code it appears that the author intending for the origin of the parallax to be the center of the map. 在仔细检查代码后,似乎作者打算将视差原点作为地图的中心。 This is problematic because it causes the issue described above, so I rewrote it such that the viewport is always bound to the 0.00 viewplane. 这是有问题的,因为它导致了上述问题,因此我重新编写了视口,使其始终绑定到0.00视平面。

If anyone is interested in the code, reply to this answer and I'll make it available. 如果有人对代码感兴趣,请回复此答案,然后我将其提供。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM