I need help with Overlap Boxes and Sprite Kinds

I’m trying to make a game where the character gets points for eating food. I have the game randomly places three food sprites at the start of the game. All of the food sprites are set to sprite kind “food”.

The problem occurs when my character overlaps the food. If the character overlaps one food sprite all three food sprites disappear.

I only want the food the character overlaps to disappear.

Can anyone tell me how to do this without making three different sprite kinds and three different overlap boxes?

1 Like

In most events in arcade, there are local variables you can drag out from the top of the block. Like this:

2022-01-03 16.44.51

(note you can also drag out “sprite” from this event)

The local variables always refer to whatever sprites are involved in the actual event. In this case, “sprite” will point to the player and “otherSprite” will point to the food. So if your write your event just using otherSprite instead of the global variables you defined, you should only need to have one overlaps event.

1 Like


1 Like