From BlenderWiki

Jump to: navigation, search

Properties

Properties are the game logic equivalent to variables. They are stored on the object and can be used to represent things about them such as ammo, health, name, and so on.

Properties Panel

The properties panel.

The properties panel is made up six parts:

(1) Add Property button
This button adds a new property to the list, default is a Float property named “prop”, followed by a number if there already is one with this name.
(2) Delete button
Next to each property is the button to delete it.
(3) Property type menu
It determines which type of property it is (see bellow).
(4) Name field
Where you give your property its name, this is how you are going to access it through python or expressions. The way to do so in python is by dictionary style lookup (GameObject["propname"]). The name is case sensitive.
(5) Value field
Sets the initial value of the property.
(6) Debug button
Turns on debugging. Note that you must also tick Show Debug Properties in the Game menu. When done all properties with debugging activated will be presented with their object name, property name and value during gameplay. This is useful if you suspect something with your properties is causing problems.


Property types

There is five types of properties:

Timer
Starts at the property value and count upwards as long as the object exists. It can for example be used if you want to know how long time it takes the player to complete a level.
Float
Uses a decimal number as value, can range from -10000.000 to 10000.000. It is useful for precision values.
Int
Uses integers (whole numbers) as value, between -10000 and 10000. Useful for counting things such as ammunition where decimals are unnecessary.
String
Takes text as value. Can store 128 characters.
Bool
Boolean variable, has two values true or false. This is useful for things that has only two modes, like a light switch.


Property Sensor

Property sensor has four modes:

Equal
Triggers a positive pulse when the property value matches the value in the sensor.
Not Equal
Triggers a positive pulse when the property value differs from the value in the sensor.
Interval
Triggers a positive pulse when the value of the property is between the Min and Max values in the sensor.
For “more than”, enter the property name in the Max field and the lowest number for triggering in the Min field.
For “less than”, enter the property name in the Min field and the maximum value in the Max field.
Names of other properties can also be entered to compare properties.
Changed
Triggers a positive pulse when the value of the property changes.


See Sensors for more general information on the use of sensors and property sensor for more detailed information about the Property sensor.

Property Actuator

The Property actuator has four modes:

Assign
Gives the the value in the Value field to the property in the Prop field. Can only be a property of the same object.
Add
Increases the value of the property, enter a negative value to subtract. For Bool, a value other 0 (also negative) is counted as

True.

Copy
Copies a property from another object to a property of the actuator owner.
Toggle
Switches 0 to 1 and any other number than 0 to 0. Useful for on/off switches. Does not work with String properties.

See Actuators for more general information on the use of actuators and Property Actuator for more detailed information about the Property actuator.