use of com.ilargia.games.entitas.egdx.base.util.FixtureDefBuilder in project Entitas-Java by Rubentxu.
the class AddViewSystem method execute.
@Override
public void execute(List<GameEntity> entities) {
for (GameEntity e : entities) {
Texture texture = assetsManager.getTexture(String.format("assets/textures/%1$s.png", e.getAsset().name));
Body body = bodyBuilder.fixture(new FixtureDefBuilder().boxShape(0.5f, 0.5f)).type(BodyDef.BodyType.KinematicBody).build();
TextureRegion textureRegion = new TextureRegion(texture, 0, 0, texture.getWidth(), texture.getHeight());
e.addTextureView(e.getAsset().name, textureRegion, body);
//
if (e.hasPosition()) {
Position pos = e.getPosition();
body.setTransform(new Vector2(pos.x, pos.y + 1), 0);
}
}
}
Aggregations