Help Creating Clones/Copies with Behaviors in CoBlocks

Hello,

I’m currently trying to create a space shooter style game with CoBlocks and having trouble figuring out how to create copies of a 3D model and each copy follow a set of instructions. I’ve created this behavior in Scratch with the “Create Clone” block and “When I start as a Clone” block but I can’t seem to figure out something similar in CoBlocks. Once a copy is created how can I code the behaviors of the copies?

So far, I have been able to create copies of a sphere that go to random locations on an axis every second. However, once each copy arrives at its random location I would like the copy to move forward and if colliding with the camera or other object do something. I’m also trying to delete the copies once they arrive at a certain location.

Here’s what I have so far. I’m using the “create a copy of” expression in the actions https://cospac.es/sREk

Thanks for any input.

Hi @Gustavo,

You can use “set variable” CoBlock from the Data Category to store the created item and give it instructions.
I modified you Space to make what you need with that block.

Hope that helps

3 Likes

Aha! Got it, thanks so much!

Another way is to create an Object Factory function - this essentially does the same thing as above, just in a tidier way which can be called in multiple places. See https://cospac.es/PL5j for an example.

2 Likes