FlxBitmapText does not show after setGraphicSize()

  • Hey,

    This is the first game I am developing and I love HaxeFlixel so far. But I can't get my head around resizing and positioning FlxBitmapText. I have to set the size and position in relation to another element. To get the right width and height, I do updateHitbox() after resizing. But when I do that, I only get an empty red box in debug mode...

    I am targeting cpp (ios, android, mac) with flixel 4.2.1

    alt text

            var percentage = GameMGMT.getPercentage(world, i);
            var percentageTxt = new FlxBitmapText(Design.BITMAPFONT);
            percentageTxt.text = percentage + "%";
            var percentageHeight = Math.floor( levelBtn.height * 0.25 );
            percentageTxt.setGraphicSize(0, percentageHeight);
            //Center text on Button
            var percentageY = levelBtn.y + Math.floor( levelBtn.height * 0.6);
            var percentageX = levelBtn.x + Math.floor( ( levelBtn.width / 2) - ( percentageTxt.width / 2 )  )  ;
            percentageTxt.setPosition(percentageX, percentageY);

    I think I am approaching BitmapFonts totally wrong, but I am out of ideas... Can you give me some advice, how to use them correctly?

    Thank you so much!

Log in to reply

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.