Scene クラスは、画面に描写する全てのオブジェクトの最上位に位置するコンテナです。 Scene は特定数のレイヤーを持っており、レイヤー自身はいくつかのEntityを(固定的もしくは動的に)保持することができます。 camera の位置に関わらずScene の同じ位置に自身を描写する、CameraScene/HUD/MenuSceneのようなサブクラスがあります。 Scene は Entity クラスのサブクラス(拡張版)です。
Creating and understanding Scenes:The Scene class is the root container for all objects to be drawn on the screen. A Scene has a specific amount of Layers, which themselves can contain a (fixed or dynamic) amount of Entities. There are subclasses, like the CameraScene/HUD/MenuScene that are drawing themselves to the same position of the Scene no matter where the camera is positioned to. |
Sceneを作成するのは本当に簡単で、一行だけでできます:
Scene newScene = new Scene();
Scene を管理する方法(表示や切り替え)をまだ知らない場合は、この記事を読んでください。
1. Creating new Scenes:Creating scenes is really easy, its just matter of one line:
Scene newScene = new Scene();
Read this article, if you still do not know how to manage scenes (display/switch them) |
既定では、全Scene は有効状態の背景 (白色)を持っているので、子Scene のみを見ることができます(ゲームプレイ用のSceneに子Sceneを設定した場合)。 scene の背景を無効にするには以下を実行します (この例では、子Sceneの背景を無効にしており、ポップアップとポップアップの下にあるSceneが両方とも見えるようになります。 - ちょうど画面上にあるように)
yourScene.setBackgroundEnabled(false);
2. Scene without background:I found it especially useful, while using child scenes, lets say we have game play scene, and we want to set child scene to our game-play scene (Ex. some kind of popup)Since by default, each scene have background enabled (white colour) we would be able to see only child scene (After setting child scene to the game-play scene) To disable background of any scene (in this example we would disable background of the child scene, so popup would be visible AS WELL AS A scene "under" popup - just like on the screen)
yourScene.setBackgroundEnabled(false);
|
注意事項
|