# Need help with merge mechanics

**URL:** <https://forum.defold.com/t/need-help-with-merge-mechanics/75957>\
**Category:** Questions\
**Created:** [February 10, 2024, 2:25pm UTC](https://forum.defold.com/t/need-help-with-merge-mechanics/75957 "2024-02-10T14:25:24Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [February 10, 2024, 7:48pm UTC](https://forum.defold.com/t/need-help-with-merge-mechanics/75957/3 "2024-02-10T19:48:17Z")

</div>

> [@greenlarity](#):
>
> For example, I want to understand that a pear collided with a pear, which means that they then stack and turn into an orange.

You could use one physics group per fruit and let each fruit only collide with the walls and its own kind. You achieve this by setting the group and mask fields of each collection object. You can check which group you collide with by checking `message.other_group`.

The other option is to do what you are doing in your code and check which sprite animation you have and compare it to the list of all fruits. BUT I think you have a bug in your code, the `go.get(url, "animation")` will return a hash, not a string, which means that you should store hashed strings in your `fruit_list`.

By the way, here’s a similar game made in Defold. I’m sure @schlista can give you advice as well.

> [@Kabocha (Pumpkin) Game Please Provide Feedback](https://forum.defold.com/t/kabocha-pumpkin-game-please-provide-feedback/74729):
>
> I’ve been working on this for a little over 1 week. Dang Defold is so sweet! I still have a bit more polish to add, but I think the 3 game modes are complete. Casual: Play at your pace. Game is over if a veggie falls out of your shopping bag. Challenge: Similar to Casual but you only get one chance to drop the veggie as it quickly moves from left to right. Timed: You aren’t playing for a high score, but a fast time to get to a pumpkin. If Veggies fall out of the cart the game keeps playin…

---

_[View the full topic](https://forum.defold.com/t/need-help-with-merge-mechanics/75957)._
