How to convert this logic to python code? enter image description here

  • $\begingroup$ Take a look at TutorialsForBlender3D. It's a very comprehensive website for basic functionality for just about everything. It discusses each logic brick in Python form and options you have. $\endgroup$ – Daniel Jul 2 '15 at 22:22

look at http://blenderartists.org/forum/showthread.php?294632-Convert-Logic-bricks-to-python-scripts-how and read "kastoria" post.

they said "As far as I know, there is no automatic way to convert the logic bricks into Python script. However, porting the logic bricks into Python should be very straight forward. Each Sensor goes into a Controller that is a simple "AND" or "OR" operation.

Step 1) Replace all the and/or Controllers with Python controllers that simply do the same AND/OR operation. Step 1.5) Test everything to ensure nothing has been broken.

Step 2) Remove all the Keyboard/Joystick/Mouse button sensors and access them directly in your Python though Step 2.5) Test everything to ensure that nothing has been broken. bge.logic.keyboard, bge.logic.joysticks, bge.logic.mouse, etc.

Step 3) Remove the Actuators that are easy to do. Things like 'Property' and movement actuators are pretty straight forward to replace with Python code Step 3.5) Test everything again to ensure nothing has broken.

Step 4) Move the more difficult Actuators to Python. Things like 'Action' actuators that play animations require a bit of work to replace with Python code. Step 4.5) That's right, test again." but to be honest i dont know if this will work for you or not since im new to blender still.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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