libgdx-如何为参与者使用动态位置?

zhte4eai  于 2021-07-06  发布在  Java
关注(0)|答案(0)|浏览(225)

我正在建立一个棋盘游戏,但我有一些关于演员的位置问题。演员的位置在桌面和android上是不同的。我解决了演员的大小问题

float height= Gdx.graphics.getHeight() * 0.088f;
float width= Gdx.graphics.getHeight() * 0.088f;

stampadapter类自动生成戳记。我手动添加戳记的位置,所以这会在不同的屏幕大小(如桌面和手机)上造成一些问题。

//StampActor("name",texture, position x,position y,width,height);
stamps.add(new StampActor("Player_Stamp_1",texturePlayer,536.19995F,423.6F  ,width,height));
        stamps.add(new StampActor("Player_Stamp_2",texturePlayer,536.19995F,384.6F  ,width,height));
        stamps.add(new StampActor("Player_Stamp_3",texturePlayer,60.19999F,423.6F  ,width,height));
        stamps.add(new StampActor("Player_Stamp_4",texturePlayer,60.19999F,384.6F  ,width,height));

游戏屏幕类将演员添加到舞台。

for(StampActor stamp : stamps.getStamps()) {
        new MoveStamps(Game,stamp ,locX,locY);
        Game.stage.addActor(stamp);
 }

在android上:android仿真器的屏幕截图
桌面上:屏幕截图桌面

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题