Draggable objects taking transparent pixels into account

Would it be possible to make it where the Mouse Over and the Draggable functions ignore transparent pixels? Ie, if the sprite is an irregular shape, to only drag when you click on the shape itself and not the bounding box?

You need to use a cursor object and check for collision between the two objects.

But I believe that it will return true for the collision even on transparent pixels

Not if you set up a proper/custom hitbox in the object’s properties.

A custom hitbox makes no difference. It’s like the dragging behaviour only does a bounding box check, not a hitbox check

The draggable behavior, probably.
As I wrote above, you need a cursor object and the object collision condition.

Is this what you mean?

I created an object called Cursor that just follows the mouse. Then I check if the Cursor object is colliding with what I want to drag (in this example, an object called Email). If the condition is true, I activate the draggable behaviour. Otherwise, I deactivate it.

So this doesn’t use the transparency of the PNG file, but the customizable hitbox instead.

It works pretty well, I must say. Good idea, thanks for the suggestion!

2 Likes