カメラの中央位置を変更する場合に(例えばプレイヤーの位置を追いかける場合)、これはほとんど全てのゲームにとって本当に便利な機能です。 これをするためには、 BoundCameraクラスを使うか、継承する必要があります。そうすることで、カメラ領域の設定を司るメソッドにアクセスできるようになります。
Setting Camera bounds:This is really useful feature, mostly for all kind of games, while updating camera center position (while for example chasing player`s position) to do it, we need to use BoundCamera class or its extensions to be able to access methods responsible for setting camera bounds. |
camera.setBounds(0, 0, 2000, 780); camera.setBoundsEnabled(true);
最初の二つのパラメータは、カメラ領域の最小のX,Y位置です (この場合は、カメラ領域の左下の位置になります)。次の二つのパラメータはカメラ領域の最大位置です。 カメラの位置はx座標2000,y座標780の値を超えないことを意味します。
1. Setting camera`s bounds:All we have to do, is to use two methods:camera.setBounds(0, 0, 2000, 780); camera.setBoundsEnabled(true); First two parameter are minimal X and Y bound position (in this case bottom left corner) Two next are maximum bound position. Which means camera`s position will not exceed 2000 x and 780 y value. |
注意事項
|