change property with python?

Is there a way to change the value of a property with a python script?
I’ve been trying to make a “double jump” system with python for a while now. I know you can do it with the logic bricks and states, but python would be more efficient and it’s a good exercise.

What I have found is that when an object has a property and you make a call to that property in python, you get to use the numerical value of that property, but you cannot interact or change the property’s actual value.Is there a way to change the value of the property and have the change remain after the script has finished?

(also, how do you turn on shadows for the GE?)

There’s a number of ways to change properties in python if you just know how to do operations, try the ones below for starters

NOTE: The beginning of the script would be

 
c = GameLogic.getCurrentController()
ob = c.owner

[------------------------------------------------------------------------------------------------------]
OPERATION EXAMPLES::

 
ob['prop'] += 1
ob['prop'] -= 1
ob['prop'] *= 1
ob['prop'] /= 1
ob['prop'] += ob['prop2']
ob['prop'] = ob['prop2']+ob['prop3]/2-ob['prop4']

ect…

Awesome, thanks. I’ve attached my double jumping cube with just 1 state incase anyone’s curious.

Attachments

Python_jumps.blend (144 KB)