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.
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.
There is five types of properties:
- 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.
- Uses a decimal number as value, can range from -10000.000 to 10000.000. It is useful for precision values.
- Uses integers (whole numbers) as value, between -10000 and 10000. Useful for counting things such as ammunition where decimals are unnecessary.
- Takes text as value. Can store 128 characters.
- Boolean variable, has two values true or false. This is useful for things that has only two modes, like a light switch.
Property sensor has four modes:
- 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.
- 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.
- Triggers a positive pulse when the value of the property changes.
The Property actuator has four modes:
- Gives the the value in the Value field to the property in the Prop field. Can only be a property of the same object.
- Increases the value of the property, enter a negative value to subtract. For Bool, a value other 0 (also negative) is counted as
- Copies a property from another object to a property of the actuator owner.
- Switches 0 to 1 and any other number than 0 to 0. Useful for on/off switches. Does not work with String properties.