Movement controls are way out of wack with CoBlocks

I’m using CoBlocks “when up key is down, move casual man #2 forward 1 meter in 1 second”. This works well for very basic movement, but how do I code it to have the character move as long as I’m pressing down? He’ll only walk for 1 meter and then stop, and I have to press it down again.

Along the same lines, how do I program my left arrow key to turn the camera for as long as I’m pressing down? Everything I see for turning has to be calculated with a predetermined angle or time period.

You can use a loop.

It does make the script go crazy when launching, so you will have to stop the script when prompted. Don’t worry, the code will still work once the space is launched. If someone else knows how to correct that part, let us know!

Why do you need a loop here, @jamesmccrary ? I think you can do it like this.

Interesting. I was having the same results as @efkzach where it did not repeat the command and only moved the defined space in the defined time once with every press. Once I remixed your space, now it responds appropriately. I know Zach used “down”, but “pressed” responded similarly in my space. Momentary glitch, I guess.

For the camera, you can use the same code and reduce the degree of rotation and time. Now that the “pressed” is working as @Pavel showed, it’s pretty simple to do.

1 Like