haxeopenflhaxeflixellime

Ignore transparent pixels on sprite


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?


Solution