你好我是andengine的新手,我一直在使用andengine食谱,并已经达到了创建模拟控制器的部分。我已经编写了一些代码来移动和旋转精灵,但每当我运行它时,我都会遇到运行时错误。
mController = new AnalogOnScreenControl(controllerX, controllerY,
mCamera, controllerBaseregion, controllerknobregion, 0.1f,
mEngine.getVertexBufferObjectManager(),
new IAnalogOnScreenControlListener() {
@Override
public void onControlChange(
// TODO Auto-generated method stub
// pvalues is the direction of dragging
BaseOnScreenControl pBaseOnScreenControl,
float pValueX, float pValueY) {
mainSprite.setPosition(mainSprite.getX() + (pValueX + 2),
mainSprite.getY() + (pValueY + 2 ));
mainSprite.setRotation(pValueX);
Log.d("mainSprite", String.valueOf(mainSprite.getRotation()));
}