Advertisement
Guest User

Untitled

a guest
Nov 14th, 2017
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. BodyDef bodyDef = new BodyDef();
  2. bodyDef.linearDamping = 1f;
  3. MapLayers mapLayers = screen.getTiledMap().getLayers();
  4. MapLayer mapLayerPlayer = mapLayers.get("player_position");
  5. bodyDef.type = BodyDef.BodyType.DynamicBody;
  6. player2body = world.createBody(bodyDef);
  7. FixtureDef fixtureDef = new FixtureDef();
  8. PolygonShape shape = new PolygonShape();
  9. Vector2[] vector2s = new Vector2[4];
  10. vector2s[0] = new Vector2(-24, 132).scl(1 / Application.PPM);
  11. vector2s[1] = new Vector2(24, 132).scl(1 / Application.PPM);
  12. vector2s[2] = new Vector2(-20, 4).scl(1 / Application.PPM);
  13. vector2s[3] = new Vector2(20, 4).scl(1 / Application.PPM);
  14. shape.set(vector2s);
  15. fixtureDef.shape = shape;
  16. player2body.createFixture(fixtureDef).setUserData(this);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement