Ignore transparent pixels on sprite

87 Views Asked by At

So I need the sprite to get bigger when I hover over the sprite with the mouse. But the problem is that the sprite has an unusual shape, which leaves a lot of transparent space. And the mouse reacts to this transparent space.

override public function create()
{
    image = new FlxSprite(100, 100).loadGraphic("assets/images/freeplay.png");
    add(image);
}

override public function update(elapsed:Float)
{

    image.scale.set(1, 1);

    if (FlxG.mouse.overlaps(image))
    {
        image.scale.set(1.1, 1.1);
    }

    super.update(elapsed);
}

How can I make the sprite not react on a transparent background?

1

There are 1 best solutions below

0
On BEST ANSWER