내 이미지가 있습니다 (설명을 위해 Image.png
이라고 말하면 됨). 그리고 내가 그린 몸에 맞게 잘 확대하려고합니다. 시체와 모든 디버그와 함께 작동하지만 그것의 팬이 아니에요 ... SpriteBatch
화면에 배경 이미지를 그릴 것입니다 (너무 규모가 좋을 것입니다). Image.png
을 렌더링 된 동적 몸체와 동일한 크기/위치로 스케일하는 방법은 무엇입니까?LibGDX SpriteBatches로 이미지 크기 조절
편집 : 이미지를 그리는 동안, 나는
이 몸 만들기 .. 그들이 시체를 렌더링 디버그와 일치하는 위선적 인 말투 :
BodyDef bodydef2 = new BodyDef();
bodydef2.type = BodyType.DynamicBody;
bodydef2.position.set(camera.viewportWidth + 30.0f, (int)(Math.random()*camera.viewportHeight)%(LastPlatformY+5)+20);
//System.out.println(bodydef2.position.y + " " + LastPlatformY);
Body block = world.createBody(bodydef2);
PolygonShape Shape2 = new PolygonShape();
Shape2.setAsBox(750*WORLD_TO_BOX, 200*WORLD_TO_BOX);
FixtureDef fixtureDef2 = new FixtureDef();
fixtureDef2.shape = Shape2;
fixtureDef2.density = 1000.0f;
fixtureDef2.friction = 0.0f;
fixtureDef2.restitution = 0;
block.setLinearVelocity(new Vector2((float) (Platform_Velocity*-1), 0));
block.createFixture(fixtureDef2);
//Lock 'block' to X-Axis, Relative to floor.
PrismaticJointDef jointDef = new PrismaticJointDef();
jointDef.collideConnected = true;
jointDef.initialize(block, groundBody, block.getWorldCenter(), new Vector2(1, 0));
world.createJoint(jointDef);
Platforms.add(block);
Platforms_Created++;
LastPlatformY = (int)bodydef2.position.y;
그리기 이미지 :
sp.draw(platforms, (float)(Platforms.get(i).getPosition().x), (float)(Platforms.get(i).getPosition().y), 75,20);
을
수정 # 2 : 카메라가 화면 크기보다 작 으면 위치 변동에 대한 보상을해야합니다. 문제가 해결되었습니다.
가'BOX_TO_WORLD' 무엇을 그릴 할 때? – Chris
는 BOX_TO_WORLD을 알아 냈지만 이미지가 보이는 몸으로 이미지를 정렬하기 위해 수학이 꺼졌습니다. – Chris