Duplicating 'on activate' behaviour for objects

Continuing the discussion from Copy/pasting coded objects to behavior:

Hi there, I’m wondering if there is a way to have the lists work with a ‘on activate’ event - so that each object in the list behaves the same way when activated?

I have about 20 objects in the space that I would like to behave in the same way (on activate, move up).

Right now I’m duplicating the ‘on activate’ block and changing the ID so each object has a block. It works but I’m guessing there is a more efficient way to do this.

Hi @yvonne_c! You can try some code like this:

  1. Create a list and fill it with items
  2. Use the “for each (item) in list” block
  3. Use the “item” variable that is generated by the “for each (item) in list” block. The variable “item” can be found in “variables” category
  4. Use “item” wherever you want all items in the list to do something.

The code should look something like this:

myList

Please let me know if you have any other questions.

Thanks

Hi @Ben It works! thanks so much for your very speedy help :slight_smile: I was trying to drag out the default object in the on activate block and didn’t realize could just drop in the item block over it.

1 Like