I have 3 properties from three different "throws" in a game in which I want to add up the 3 scores and produce a total.

I have 3 properties holding each score and those work fine. I have a 4th property as a total which I then use "assign" "THROW 1+THROW 2+THROW 3" but the total always comes to -1.

I have everything typed correctly but not sure how to solve this. Using python is not an option with my limited programming skills.


1 Answer 1


Using logic bricks you assign the calculated result to the final score property. The value field for the assign is a python string that can use the property names directly. The thing to check would be that the type of each property can hold a numeric value.

example final score assignment

Another way to do it would be to add to both scores at the same time, by connecting two property actuators to the same controller. But that would depend on whether you had both scores displayed at the same time.

adding to two properties at once

You only need limited programming skills to use python for this example, the script to do it is only a few lines and is easy to understand.

import bge

cont = bge.logic.getCurrentController()
player = cont.owner

player['final'] = player['score1'] + player['score2'] + player['score3']

The getCurrentController gets the python controller that is running the script, the owner of that is the object with the game properties. You put the property name inside square brackets ['score1'] to use the value in the script.


Not the answer you're looking for? Browse other questions tagged .