1
votes

I have little problem with my code... I'm learning physics and collisions in andengine and while I trying create some new object eclipse returns me error:

Body cannot be resolved to a variable The method createBoxBody(PhysicsWorld, IAreaShape, BodyDef.BodyType, FixtureDef) in the type PhysicsFactory is not applicable for the arguments (PhysicsWorld, Shape, BodyDef.BodyType, FixtureDef)

I'm using andengine & andenginephysicsbox2d extension... and i want to do sth like in example andengineexamples

Elipse returns me error even I change 'Texture' in to 'mgame_pandus' -> why? Maybe I downloaded bad package of andenginePB2D? If anybody could help me i will be very gratefull It's my code:

protected Scene onCreateScene() {
    Scene scene = new Scene();
    ParallaxLayer parallaxLayer = new ParallaxLayer(camera, true, 4000);
    Sprite Srace_theme = new Sprite(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT, mrace_theme, this.getVertexBufferObjectManager());
    parallaxLayer.setParallaxChangePerSecond(2);
    parallaxLayer.setParallaxScrollFactor(1);
    parallaxLayer.attachParallaxEntity(new ParallaxEntity(-110, Srace_theme, false, 1));
    final FixtureDef RectFixtureDef = PhysicsFactory.createFixtureDef(0, 0.0f, 0.0f);
    scene.attachChild(parallaxLayer);
    PhysicsWorld physics_world = new PhysicsWorld(new Vector2(0,0), false); 
    scene.registerUpdateHandler(physics_world);
    final FixtureDef objectFixtureDef = PhysicsFactory.createFixtureDef(1, 0.5f, 0.5f);
    final Shape Texture = new Rectangle(0,CAMERA_HEIGHT-2,CAMERA_WIDTH-2, 2, this.getVertexBufferObjectManager());      
    PhysicsFactory.createBoxBody(physics_world, Texture, BodyType.KinematicBody, RectFixtureDef);

//  - Body cannot be resolved to a variable
//  - The method createBoxBody(PhysicsWorld, IAreaShape, BodyDef.BodyType, FixtureDef) in the type PhysicsFactory is not applicable for the 
//   arguments (PhysicsWorld, Shape, BodyDef.BodyType, FixtureDef)

    return scene;
}

My whole code avalible on pastebin: here

1

1 Answers

0
votes

I think you are using GLES1 branch library.Download latest GLES2 branch lib from this link