我的代码没有什么问题...我正在学习物理和动态的碰撞,当我尝试创建一些新的对象eclipse时返回错误:
Body无法解析为变量方法 createBoxBody(PhysicsWorld,IAreaShape,BodyDef.BodyType,FixtureDef) 在PhysicsFactory类型中不适用于参数 (PhysicsWorld,Shape,BodyDef.BodyType,FixtureDef)
我正在使用andengine& andenginephysicsbox2d扩展......我希望像示例中那样andengineexamples
Elipse返回错误,即使我将'Texture'更改为'mgame_pandus' - >为什么? 也许我下载了andenginePB2D的坏包装? 如果有人能帮助我,我将非常感激 这是我的代码:
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;
}
我在pastebin上的整个代码:here