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.
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:
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!