I'm new to Blender and I am trying to use the Game Engine of it. The idea is that after pressing the button with shape of a cube called "Cubos" it creates a wall of blocks.

But I noted that the code is executed twice because it creates a block called "(0, 0, 5)" and another called "(0, 0, 5).001". How can I fix that and only execute it once?

To execute the script I have done this: create two sensors and connect them with And controller, then execute a Property actuator which changes the variable cubos to True. A third sensor will check when cubos is changed to True and will execute a Python controller (the script) and an And controller which executes another Property actuator that changes the variable cubos to False... that was my best attempt to combine a And and a Python controller :).

You can see that explanation in the picture:

enter image description here

In order to not see a lot of blocks, I changed the size of the wall to range(0,1).

Also, as a side question, I noted that my code doesn't create the blocks when the game engine is active, but it moved the block. Instead, after stopping the game engine cubes are made and doesn't banish, but the moved block to return to its normal location... how can I fix that? I want to make the block while the game engine is active and after stop it I want to banish/remove that blocks.

New contributor
Ender Look is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

Ender Look is a new contributor. Be nice, and check out our Code of Conduct.
 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.