简体   繁体   English

如何使用libGDX创建滚动背景

[英]How to create a scrolling background with libGDX

I'm trying to find a better way to create a scrolling background in android studio for a game I am making. 我正在尝试寻找一种更好的方法在android studio中为正在制作的游戏创建滚动背景。 I could just load the image twice and have them scroll side by side, but I am wondering if there is a better way to do it. 我可以将图像加载两次并让它们并排滚动,但是我想知道是否有更好的方法可以做到。 The background needs to be moving at a constant rate, as the character never moves from the center of the screen. 背景必须以恒定的速率移动,因为角色永远不会从屏幕中心移动。 The movement of the background is completely independent from everything else. 背景的运动完全独立于其他一切。

Better way than 比更好的方法

I could just load the image twice and have them scroll side by side 我可以将图像加载两次,并排滚动

until they invented. 直到他们发明了。

In this answer there is an example code. 此答案中有示例代码。

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

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