利用者:Sculptorjim/Game Engine/Logic

提供: wiki
< 利用者:Sculptorjim‎ | Game Engine
2012年7月9日 (月) 19:41時点におけるwiki>Sculptorjimによる版
(差分) ← 古い版 | 最新版 (差分) | 新しい版 → (差分)
移動先: 案内検索

Logic, Properties and States

Game Logic is what causes anything to happen in the game. Each actor object in the game has "logic bricks" which control its behavior during the game; these logic bricks can be tweaked and combined to create the necessary interactions and reactions to user commands which make up the overall game behavior.

Logic Bricks

The main part of game logic can be set up through a graphical interface the Logic Editor, and therefore does not require detailed programming knowledge. Logic is set up as blocks (or “bricks”) which represent preprogrammed functions; these can be tweaked and combined to create the game/application. There are three types of logic brick: sensors, controllers and actuators. Sensors sense when things happens, such as a collision, a key press, mouse movement. Controllers carry out logic operations on sensor signals, and send their output signals to actuators. Actuators make the actors perform the operations which make up the game behavior.

Properties

Properties are like variables in other programming languages. They are used to save and access data values either for the whole game (eg. scores), or for particular objects/players (e.g. names). However, in the Blender, a property is associated with an object. Properties can be of different types, and are set up in a special area of the Logic Editor.

States

Another useful feature is object "States". At any time while the game is playing, the current state of the object defines its behavior - eg. an actor object may be "sleeping", "awake" or "dead", and its logic behavior may be different in each of these three states. The states of an object are set up, displayed and edited in the Controller logic bricks for the object.