0

私は AndEngine に比較的慣れておらず、1 つの問題で立ち往生しています。Tiledで作ったゲームでキャラクターが左右に移動できるサンプルデモゲームを作りました。デフォルトでは、ゲームが開始されると、シーン/カメラとキャラクターが画面の左側に配置されます。ランドスケープ モードでは、カメラは画面の左端から右側に移動します。以下は私の作業コードです:

private BoundCamera mCamera;
@Override
    public Engine onLoadEngine() {

        this.mCamera = new BoundCamera(-100, -100, CAMERA_WIDTH, CAMERA_HEIGHT){
            @Override
            public void onApplySceneMatrix(GL10 pGL) {
                    GLHelper.setProjectionIdentityMatrix(pGL);

                    GLU.gluOrtho2D(pGL, (int)this.getMinX(), (int)this.getMaxX(), (int)this.getMaxY(), (int)this.getMinY());
            }

        };

        final EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT),
                mCamera);
        engineOptions.getTouchOptions().setRunOnUpdateThread(true);
        engineOptions.setNeedsMusic(true).setNeedsSound(true);

        // It is necessary in a lot of applications to define the following
        // wake lock options in order to disable the device's display
        // from turning off during gameplay due to inactivity
        engineOptions.setWakeLockOptions(WakeLockOptions.SCREEN_ON);

        final Engine engine = new Engine(engineOptions);

        try {
            if (MultiTouch.isSupported(this)) {
                engine.setTouchController(new MultiTouchController());
                if (MultiTouch.isSupportedDistinct(this)) {

                } else {
                    Toast.makeText(this, "(MultiTouch detected, but your device might have problems to distinguish between separate fingers.)",
                            Toast.LENGTH_LONG).show();
                }
            } else {
                Toast.makeText(this, "Sorry your device does NOT support MultiTouch!\n\n(Falling back to SingleTouch.)", Toast.LENGTH_LONG).show();
            }
        } catch (final MultiTouchException e) {
            Toast.makeText(this, "Sorry your Android Version does NOT support MultiTouch!\n\n(Falling back to SingleTouch.)", Toast.LENGTH_LONG).show();
        }

        return engine;
    }

new BoundCamera()コンストラクターで異なる値を適用しようとしました。しかし、何も機能しません。これを解決するために私を導いてください。ランドスケープ モードで画面の右端からカメラとシーンを開始したい。

4

1 に答える 1