Sending message to self?

Okay, I need to know how to send a message to all the blocks that are in it’s kind.

EXAMPLE: Hit block. Block sends message to all of it’s kind to delete themselves.

I’m not 100% sure I understand what you mean, but I think that you can get what you want by making an object called “destroyable” or something. Then in all of the objects you want to be destroyed, set their parent to “destroyable” and send your destroy message to all the “destroyable” objects.

Or, maybe I don’t actually understand what you’re trying to accomplish :slight_smile:

2 Likes

I know that there is a way, you just send it to your object, but I’m wondering if there’s an alternative.

For example:
image

A good way to do this is through raycasting and then spawning a block. Or, for more basic shapes, you could just use a bigger sprite for the barrier.

Tutorial

Logic for the Barrier Block: Also, you don’t need to use raycast. You can use collision instead.

Logic for the Delete Barrier Block:

Make sure that both of those blocks have an alpha of zero, unless you want the barriers to be visible, in which case, only give the delete barrier blocks alpha 0.

If you want to change what triggers the barrier to go offline, replace the collision trigger to a message. You only need to send it to one of the blocks to make it work.

1 Like