ObjectGenerator.java 文件源码

java
阅读 26 收藏 0 点赞 0 评论 0

项目:Planet-Generator 作者:
public Orbiter createMoon() {
    ColorGroup colors = new ColorGroup()
            .add(Color.rgba8888(176f / 255f, 155f / 255f, 178f / 255f, 1f))
            .add(Color.rgba8888(156f / 255f, 155f / 255f, 190f / 255f, 1f))
            .add(Color.rgba8888(223f / 255f, 233f / 255f, 180f / 255f, 1f))
            .add(Color.rgba8888(75f / 255f, 109f / 255f, 133f / 255f, 1f));

    int moonCount = MathUtils.random(0, 8);

    float zTilt = zDir * MathUtils.random(10, 50);
    float xTilt = -MathUtils.random(15, 55);

    Orbiter.OrbiterBlueprint moonBlueprint = new Orbiter.OrbiterBlueprint();
    moonBlueprint.angularVelocity = velDir * MathUtils.random(15, 60);
    moonBlueprint.zTilt = zTilt + MathUtils.random(-10, 10);
    moonBlueprint.xTilt = xTilt + MathUtils.random(-10, 10);
    moonBlueprint.angle = MathUtils.random(0, 360);
    moonBlueprint.radius = MathUtils.random(100, 250);

    int color = colors.random();
    Orbiter moon = new Orbiter(createMoonSprite(MathUtils.random(16, 20) / (moonCount / 3 + 1)), moonBlueprint, color);

    scene.addMoon(moon);

    return moon;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号