I am working on a function that involves adding the RandomBlock object to the scene and then moving it downward on the screen.
function enemyPaddleMovement()
{
scene.add(RandomBlock);
RandomBlock.translateX(-8);
}
The RandomBlock object is created using the following code:
var shapes = [LeftBlock, RightBlock, middleRightBlock, middleLeftBlock, middleBlock];
var shape = shapes[Math.floor(Math.random()*shapes.length)];`
RandomBlock = new THREE.Object3D();
RandomBlock.add(shape);
My goal is to continuously spawn a new RandomBlock object every second and have it move down the screen. I have attempted using setInterval, but it only replaces the existing RandomBlock object rather than creating a new one each time.
Any assistance would be greatly appreciated.