0
public void onControlChange(final BaseOnScreenControl pBaseOnScreenControl, final float pValueX, final float pValueY) {
final Body carBody = CityRacerActivity.this.mCarBody;
final Vector2 velocity = Vector2Pool.obtain(pValueX * 5, pValueY * 5);
carBody.setLinearVelocity(velocity);
Vector2Pool.recycle(velocity);
final float rotationInRad = (float)Math.atan2(-pValueX, pValueY);
carBody.setTransform(carBody.getWorldCenter(), rotationInRad);
CityRacerActivity.this.mCar.setRotation(MathUtils.radToDeg(rotationInRad));
}
因此,這部分工作。控制精靈不完全工作
OnControlChange以正確的方向移動精靈,但是當我放開控件時,它似乎每次都將車輛向上移動。
我在android上使用andengine。
我的代碼基於racergameactivity示例,但此示例本身似乎已經存在此錯誤。