Q:

How can I control a cube's movement with a function?

I am new to blender and I'd like to make a continuous function to control the cube movement , like a square wave , when the value is one I'd like the cube to move in the y direction , when it's zero I'd like it to stop. Any idea how should I do that , using what kind of sensors?

A:

You can do this very simply with logic bricks and object properties. First , in the logic editor, hit N to open the properties editor. Now add a new property, make it a boolean type by clicking on the box that says "Float" and changing to Boolean. Boolean is the best choice since you only want two values, 1, and 0; or True and False. Now, all you need is a property sensor in the logic editor, and a motion actuator. Set the motion actuator applicably to move the cube along the y-axis, and then connect it to the sensor so that it will move when the sensor is true. Now all you have to do is set the test conditions for the sensor. Make it test for the property you just created, (default prop) and set the test value to "True"

Now you didn't specify how you wanted to change the property, but in this test file i made it happen when you hit the spacebar.

