Yea, the script is executed twice, once when you press the space bar, and once again when you release it.
So, on the first (positive) pulse, all statements are executed. On the second (negative) pulse, only the “own.Prop = 0” is executed, because “if spacebar.isPositive()” returns false on the negative pulse.
I don’t know why you need to set “own.Prop” to zero in the script. Properties have a default value of 0 as it is. So, if the default setting is your only issue, just remove “own.Prop = 0”, and it should all be fine.
PS: If you want to distinguish yourself as a programmer, do it through structure, not syntax.
# I use this in my FDM4BGE-project
if hasattr (Cube, 'int') == False:
own.Prop = 0 # reset parameter
# and so on
Cube.int=1
if spacebar.isPositive():
own.Prop =+ 1 (or += 1)
I guess I’ll set the values in the interface. The reason they need to change is say if you use a Fire Orb on the devastation sword +1 you can now set resistance to Fire and add a few ranged points.
The problem now is, what if I want multiple resistance? Is there an easy way to add props or should I just set 4 resistant slots and set them all to “” and then add resistance?