![](/img/trans.png)
[英]how to make a constant background image with moving sprite in x direction andengine
[英]Moving background image is not smooth using andengine
我正在創建一個Android游戲並使用AndEngine。 我正在使用AutoparallaxBackground移動背景。 背景運動不平穩, 它被卡住然后運動 。 如何順利移動背景?
final AutoParallaxBackground autoParallaxBackground = new AutoParallaxBackground(0, 0, 0, 5);
autoParallaxBackground.addParallaxEntity(new ParallaxEntity(-50.0f, new Sprite(0, 0, this.texRegBg1)));
autoParallaxBackground.addParallaxEntity(new ParallaxEntity(-60.0f, new Sprite(0, 0, this.texRegBg2)));
autoParallaxBackground.addParallaxEntity(new ParallaxEntity(-70.0f, new Sprite(0, 0, this.texRegBg3)));
autoParallaxBackground.addParallaxEntity(new ParallaxEntity(-80.0f, new Sprite(0, 0, this.texRegBg4)));
AndEngine中包含一個視差示例,請在您的設備上進行嘗試並確保其正常運行。
用您的紋理替換視差樣本中的一個(單個!)紋理,然后查看它是否仍能正常工作。 如果沒有-更改並修改紋理,直到獲得平滑的效果。
一次添加更多紋理。 使它們工作順利。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.