【发布时间】:2012-01-19 11:33:02
【问题描述】:
我正在使用 AndEngine 为 Android 开发游戏。到目前为止,我想在我的游戏中垂直移动相机。您可以想象类似于 Android Market 中提供的“Drop”游戏的场景,其中相机不断向下移动,您使用加速度计将球尽可能长时间地保持在场景中。 https://market.android.com/details?id=com.infraredpixel.drop&hl=en)
但是我在这里并没有取得很大的成功。无论球的位置如何,我都想不断地向下移动相机(即相机 ChaseEntity() 不起作用)。 您的帮助将不胜感激。我使用的是 GLES2 版本的 AndEngine
private static final int CAMERA_WIDTH = 720;
private static final int CAMERA_HEIGHT = 480;
private Camera mCamera;
public Engine onLoadEngine() {
this.mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
return new Engine(new EngineOptions(true, ScreenOrientation.LANDSCAPE,new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), this.mCamera));
}
protected void onManagedUpdate(final float pSecondsElapsed) {
//Move camera down
super.onManagedUpdate(pSecondsElapsed);
}
【问题讨论】: