利用者:Sculptorjim/Game Engine/Logic/Controllers/State Editing

提供: wiki
移動先: 案内検索

State Editing

State Panel Button
States are set up and edited using the Controller (center) column of the Game Logic Panel. Setting up the State system for a game is performed by choosing the appropriate state for each controller for the object's logic.

Each object has a number of states (up to 30; default = 1), and can only be in one state at any particular time. You can specify for which state each of the object's controllers will operate. Note that only controllers, not actuators and sensors, are directly affected by the state system. However, there is a special actuator, the State actuator, which can set or unset the objects State bits, and so allow the object's reaction to a sensor signal to depend on its current state.

The display of an object's state logic, and other housekeeping, is carried out using the State Panel for the object, which is switched on and off using the button shown. The panel is divided into two halves, Visible and Initial.

State Panel Visible
Visible States
In the Visible area, each of the 30 available states is represented by a light-gray square. This panel shows what logic is visible the logic brick displayed for the object. At the right is the All button; if clicked, then all the object's logic bricks are displayed (this is a toggle), and all State Panel squares are light-gray. Otherwise, individual states can be clicked to make their logic visible. (Note that you can click more than one square). Clicking the square again unselects the state.

States for the object that are in use (i.e. the object has controllers which operate in that state) have dots in them, and squares are dark-gray if these controllers are shown in the Game Logic display. The display of their connected sensors and actuators can also be controlled if the State buttons at the head of their columns are ticked.

State Panel Initial
Initial State
In the Initial area, each of the 30 available states is again represented by a light-gray square. One of these states may be clicked as the state in which the object starts when the game is run.

At the right is the I (Information) button; if clicked, and the Show Debug Properties is clicked, the current state is shown in the top left-hand corner of the display when the game is run.