How can I rezise an image in Haxeflixel?

279 Views Asked by At

I'm trying to set up a background in my game, and I want it to support multiple resolutions. I've tried using the scale trigger, but I'm pretty sure it multiplies the dimensions by the value. I need to resize the background by the resolution, so that won't work. Here's my code right now:

bgImage = new FlxSprite();
bgImage.loadGraphic(AssetPaths.SP_LevelBG__png, false, FlxG.width, FlxG.height);

bgImage.width = FlxG.width;
bgImage.height = FlxG.height;

add(bgImage);

Thanks in advance.

1

There are 1 best solutions below

0
SeiferTim On

Use scale: https://snippets.haxeflixel.com/sprites/scale/

bgImage.scale.x = 10;
bgImage.scale.y = 10;