I'm trying to create new enemies from their own class. I try to pass World from another class as parameter however when trying to add new body to world it results a nullpointer. Here's the constructor from Enemy-class
public Enemy(float x, float y, World world){
enemyTexture = new Texture(Gdx.files.internal("ball.bmp"));
BodyDef myBodyDef = new BodyDef();
myBodyDef.type = BodyDef.BodyType.DynamicBody;
myBodyDef.position.set(x, y);
FixtureDef enemyFixtureDef = new FixtureDef();
enemyFixtureDef.density = 1.5f;
enemyFixtureDef.restitution = 0.1f;
enemyFixtureDef.friction = 0.5f;
CircleShape circleshape = new CircleShape();
circleshape.setRadius(enemyRadius);
enemyFixtureDef.shape = circleshape;
enemyBody = world.createBody(myBodyDef);
enemyBody.setUserData("enemy");
enemyBody.createFixture(enemyFixtureDef);
}