From BlenderWiki

Jump to: navigation, search

Lógica del Juego

Game Logic es el responsable de todo lo que sucede en el juego. Dicha lógica está diseñada para proporcionar una herramienta poderosa para crear la lógica a través de una interfaz gráfica. Los bloques (o "ladrillos") representa las funciones preprogramadas que pueden ser ajustados y se combinaron para crear el juego / aplicación. El sistema se divide en tres partes: sensors, controllers y actuators. Sensores sentidos cuando las cosas que sucede, como una colisión, de pulsar una tecla, el movimiento del ratón. Los sensores son linked a los controladores, que comparan y activar los actuadores.

Cuando entre en el panel de Lógica por primera vez, a través de presionar F4 o seleccionando el botón del panel de lógica(GM Selecting the Game Logic Pannel.png), verá algo similar a la imagen siguiente.

El contexto de Lógica.

Para proporcionarle una mejor visión del panel de Lógica, hemos expandido algunos de los menús y los hemos númerado en la imagen de abajo. Repasaremos cada sección individualmente en el orden que se indica en la imagen.

Las diferentes partes del contexto de Lógica.


1 Objetos asociados

Logic for several objects.

La lógica en el motor de juego de Blender se adjunta a Objetos. Los objetos son enumerados por su nombre y aparecer en la ventana de la lógica cuando se han seleccionado. Usted puede seleccionar un solo objeto como en la imagen de arriba, o puede seleccionar varios objetos, como en la imagen de la derecha.

La lógica de un objeto sólo es visible cuando se selecciona el objeto (s) asociada con esa lógica.

2 Physics

These settings control how an object behaves in the game. The object type menu defines if an object is a:

  • Soft body - Physical, deforms on collision.
  • Rigid body - Physical.
  • Dynamic - Physical, stays upright.
  • Static - Physical, but unaffected by gravity.
  • Sensor - For advanced sensoring options (release notes).
  • No collision - Nonphysical.
  • Occluder - Stops the objects behind them from being sent to the GPU, to save performance (release notes).

The other settings depend of the object type, only the relevant settings will be visible. For some types there is also an Advanced menu with more options. Some settings are per material and can be accessed in by pressing the DYN button in the Material panneau, Material sub-context.

For more physics and culling options see Mist/Stars/Physics tab, in the World sub-context.

A more in-depth look at this is available on the page Actors.

3 Properties

Properties are like variables in other programming languages. They are used to save and access data associated with an object. The following types are available:

  • Timer - Starts at a defined number and counts up.
  • String - Holds text.
  • Float - Holds decimal numbers between -10000.000 and 10000.000.
  • {{Literal|Int]]eger - Holds integer numbers between -10000 and 10000.
  • Bool - Is either True or False.

For a more in-depth look, see Properties.

4 Sensors

Sensors begin all logic actions. Sensors “sense” things, such as a nearby object, a key pressed on the keyboard, timed events, etc. When a sensor is triggered, a pulse is sent to all linked controllers.

For a more in-depth look, see Sensors.

5 Controllers

Controllers handle the logic, evaluating pulses from sensors and sending pulses to actuators in response. The different kinds of controllers are:

  • AND - All connected sensors must be positive to send a positive pulse.
  • OR - One or more connected sensor has to be positive.
  • XOR - Exclusive Or: one, and only one, connected sensor has to be positive.
  • NAND - Not And, inverted And controller.
  • NOR - Not Or, inverted Or controller.
  • XNOR - Exclusive Nor controller.
  • Expression - Write your own expression.
  • Python - Control the sensor with a python script or module.

For a more in-depth look, see Controllers.

6 Actuators

Actuators affect objects or the game in some way. Actuators change motion, sound, properties, objects, etc. These changes can be in other objects, physics, properties or they can cause trigger events for other logic bricks.

For a more in-depth look, see Actuators.

7 Links

Links (7a) are the direction of logical flow between objects. Link lines are drawn by LMB Template-LMB.png dragging from one link node (7b) to another. Links can only be drawn from Sensors to Controllers or Controllers to Actuators. Sending nodes (the yellow circles found on the right-hand side of Sensors and Controllers) can send to multiple reception nodes (found on the left-hand side of Controllers and Actuators). Reception nodes can like wise receive multiple links.

You cannot directly link Sensors to Actuators. Actuators cannot be linked back to Sensors. If you desire to cause a Sensor to activate after an Actuator has completed, use the actuator sensor.