What will be the best approach for a 2D game loading area assets on libgdx?

时间:2018-06-04 17:09:39

标签: java libgdx

What will be the best approach for a 2D game loading screens assets on a libgdx game?

My game has many areas, every area have a 1920*1080 jpg image, a few animations (image sequence) and audio. I can select all areas from a map by clicking on the area,

My idea is simple, every time I click the map I load the background 1920*1080 texture load the animations as TextureRegion, and the audio as music, when I select the map and click on other area, it will dispose the everything from the previous and load the new assets.

I was thinking on loading all areas at once using assetmanager, but even if all my assets are 50 megabytes, the memory on old android devices just crash, my goal is to make fast transitions as possible when I change areas.

Please suggest.

1 个答案:

答案 0 :(得分:0)

尝试:

  1. 将所有可重复使用的精灵组合成1个纹理图集。
  2. 将精灵调整到较小的分辨率并避免创建大纹理图集(如果您想支持较旧的设备,我建议将纹理图集的大小限制为2048x2048)。
  3. 如果您想在每次用户更改地图时加载/卸载纹理图集,最好使用加载屏幕。
  4. 音乐资源由Libgdx流式传输,不会加载到内存中。但是你可以降低音乐的比特率和采样率以减小它的大小。