多くのゲームでは、プレイヤーを"追跡する"カメラが必要かもしれません - 追跡カメラは対象プレイヤーの中心部分のX,Y座標に設定されます。 これの実装は簡単です、というかAndEngine ではこの機能がCamera クラスとその拡張機能に組み込まれているので、実装の必要もありません。
Chasing Camera:In many type of games, we will probably need our camera to "chase" our player - which simply means camera will be centred on current players X and Y coordinates. It would be easy to implement, but its pointless since AndEngine has already this feature built in Camera class and its extensions. |
camera.setChaseEntity(entity);
コード中のcamera オブジェクトの部分にはゲームで使用するカメラを設定し、entity の部分にはカメラで追跡するエンティティを設定します(例えば、プレイヤー sprite など)
1. Setting chase entity:Its really easy, in fact only one line of the code:
camera.setChaseEntity(entity);
Where obviously camera object is your camera, and entity is your entity which should be chased by our camera (for example your player sprite etc)。 |
注意事項
|