AlphaMask on a spritesheet Flixel 5.5.0

23 Views Asked by At

i tried doing leftBar.mask = maskimagething; rightBar.mask = maskimagething; and even creating a sprite that des an alphamask

and so far FlxSprite doesnt have a mask option?

and im confused on how to do this since the 'left' and 'right' 'bar' variables are as long and wide as the 'bg' var

{ super(x, y);

    this.valueFunction = valueFunction;
    setBounds(boundX, boundY);

    maskingthing = new FlxSprite().loadGraphic(Paths.image(image));
    maskingthing.frames = Paths.getSparrowAtlas('mask');
    maskingthing.animation.addByPrefix('Idle', 'mask', 24, true);
    maskingthing.animation.play('Idle');
    maskingthing.antialiasing = ClientPrefs.data.antialiasing;
    //the thing im trying to get the shape for to mask the leftBar and rightBar variables onto this image

    bg = new FlxSprite().loadGraphic(Paths.image(image));
    bg.frames = Paths.getSparrowAtlas('healthBar');
    bg.animation.addByPrefix('Idle', 'healthbarbig', 24, true);
    bg.animation.play('Idle');
    bg.antialiasing = ClientPrefs.data.antialiasing;
    barWidth = Std.int(bg.width - 6);
    barHeight = Std.int(bg.height - 6);



    leftBar = new FlxSprite().makeGraphic(Std.int(bg.width), Std.int(bg.height), FlxColor.WHITE);
    //leftBar.color = FlxColor.WHITE;
    leftBar.antialiasing = antialiasing = ClientPrefs.data.antialiasing;

    rightBar = new FlxSprite().makeGraphic(Std.int(bg.width), Std.int(bg.height), FlxColor.WHITE);
    rightBar.color = FlxColor.BLACK;
    rightBar.antialiasing = ClientPrefs.data.antialiasing;

    result = new FlxSprite().makeGraphic(1280, 400, FlxColor.BLACK);
    FlxSpriteUtil.alphaMask(maskingthing, leftBar, result);
    FlxSpriteUtil.alphaMask(maskingthing, rightBar, result);

    add(result);

    add(maskingthing);
    add(leftBar);
    add(rightBar);
    add(bg);
    regenerateClips();
}
0

There are 0 best solutions below