(Solved) Pick up and grab

Hello everyone!

I could really use some help with picking and dropping objects. I’m trying to make my character pick up and drop an object, specifically this blue circle (has multiple copies of it). Does anyone have any suggestions on how to do this? An example would be incredibly helpful.

Thank you so much in advance!

For visualization:




Hey! Just today I made one example of how to do this. It’s designed for multiplayer, but basic logic applies to single player also.

Check behaviors of all objects - that is important. You can see, there are two variants - I recommend the one using physics.

Here is code, enjoy :slight_smile:

https://drive.google.com/file/d/1l_qeF2tVABgu-Q1gbcL3E08YtuK4UOpE/view?usp=sharing

Hello @radekpilmaier ,Thank you so much for your help! I’m using my phone, and I’m not sure how to open a JSON file on Android. Additionally, I want my game to function without using the physics engine. Thanks again!

Ok, so in that case see this piece of code, maybe it will help you to figure out your own solution:

I will add to it:

  • Player has defined “pick point” in points - you can edit these point inside the sprite, where you edit collision masks.

  • You check if the point is inside the object and if yes, then performer required actions.

1 Like

Thank you so much for this @radekpilmaier this helped so much. My pick and drop works fine now :grin:

1 Like