Camera Movement as a Parameter?


Is there a code block that accounts for camera movement? I have a student who wants to add footstep sound effects when the player/camera is moving but I can’t seem to find the proper code for this.

We are currently using the web-only Blockly.



Hi @egongsue,

there are various way to approach this. The easiest one would be to play a footstep sound whenever the camera has been moved. Here’s how to check for that in Blockly:

Show Blockly example

In the update-loop block, we create a “lastPosition” variable and assign the last position of the camera to it. Whenever we notice that the current camera position is not the same as the one we saved last, we play a footstep sound effect.

In this example, I generate a random number to add some variation to the sound effects, too!

Here’s a CoBlocks implementation:

Show CoBlocks example

In this example we nest a “forever” block under the “run separately” block, which will behave just as the “on update” block in Blockly.

Here are the examples in action!


Hi Stefan,

Thanks so much for your response! This is super useful for my students’ projects.