Take the 2-minute tour ×
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It's 100% free, no registration required.

I would like to know how to change the values of properties added using the "AddGameProperty" option in the game logic UI using python code?? I want to write code that changes the 'Propert' value in an Action Actuator logic block. I attached a screenshot for a bit more clarity: How do you change the game properties value to control the action actuator uisng python code??

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

If you want to access a property from the current object controller it's :

cont = bge.logic.getCurrentController()
own = cont.owner
my_property=own['propName']

But if you want to access to a property from an other object it's

scene = bge.logic.getCurrentScene()
my_property=scene.objects['other object']['otherpropName']
share|improve this answer
add comment

Your question is a bit unclear, but you can use use own['propName'] to access a property

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.