Setting up a sensor

chongyunxiang

  • Posts: 278
Hi,

I want to create a behavior, where 1 actor's collision enters another actor's collision, this activates a sensor, deactivate when both actors no longer collide, and upon mouse release, triggers an event.

I notice a sensor block, but I don't know how to set it up. I also don't see any sensor under attributes.

Basically, I want to feed food to my pet and I'm using a drag and drop feature, where the food will be fed to the pet when dropped on the pet.

Thanks!

JeffreyDriver

  • Posts: 2262
The collision shapes can be your sensors so that hits are detected, but they don't collide. That's what the sensor block does. Though I'd recommend checking the distance between your actors for your purpose.

chongyunxiang

  • Posts: 278
Thanks, I think your suggestion for distance really is better.

I tried using the MathEasy extension. I'm trying to create a behavior that I can use across all the food, where the distance between Self and Pet. But when I select it, it only shows Actor and not the other attributes. How do I set the Actor to my pet so that it only interacts with the Pet and not other actors on screen?

I've also have a problem. When I release my mouse, the food kills itself even though its not near to the pet. Did I use the block wrongly?