小编Mer*_*ify的帖子

如何改变移动体的位置 - Box2D

我目前创建了一个动态的主体,并使用Vector2()以恒定速度移动.我想要的是当身体离开屏幕边缘时,瞬间从当前点回到原点.我该怎么做呢?

    a.applyForceToCenter(aMovement, true);
    a.applyTorque(3000, true);

    FixtureDef fDef = new FixtureDef();
    BodyDef ballD = new BodyDef();

    ballD.type = BodyType.DynamicBody;

    //random location for asteroid
    int aLoc = (int) (aLocation * 15);
    float x = 300;
    switch(aLoc)
    {
    case 0:
        ballD.position.set(x, -105);
        break;
    case 1:
        ballD.position.set(x, -95);
        break;
    case 2:
        ballD.position.set(x, -80);
        break;
    case 3:
        ballD.position.set(x, -65);
        break;
    case 4:
        ballD.position.set(x, -50);
        break;
    case 5:
        ballD.position.set(x, -35);
        break;
    case 6:
        ballD.position.set(x, -20);
        break;
    case 7:
        ballD.position.set(x, -5);
        break;
    case 8:
        ballD.position.set(x, 10);
        break; …
Run Code Online (Sandbox Code Playgroud)

android box2d libgdx

5
推荐指数
2
解决办法
5610
查看次数

如何在android libgdx上保存和读取整数?

如何保存一个可以覆盖的整数,然后在android上读取它?我正在使用libgdx.我知道如何为我的桌面做这件事,但我想要内部存储.

android integer file save libgdx

1
推荐指数
1
解决办法
5625
查看次数

标签 统计

android ×2

libgdx ×2

box2d ×1

file ×1

integer ×1

save ×1