Flutter Flame Tiled Background Image wont fill screen

83 Views Asked by At

Using Flutter with Flame both with the latest versions. Trying to set a background image for the game.

In Tiled, I created a Tiled Map with a width of 120 and height of 68 using 16x16 Tile size. I added an Image layer. I then added the image (1920x1080) to the Image Layer as shown here. As you can see the image fills the entire map. enter image description here

Saved the tmx file and loaded the map using in Flutter with:

 levelGrid =
    await TiledComponent.load('level2.tmx', Vector2.all(16));

The resulting game screen is below. I added the small tree tiles in the corners to indicate the game actual screen size. The background image does not fill the entire screen as it did in Tiled.

I also set the camera using

CameraComponent.withFixedResolution(width: 1920, height:1080 )

camera.viewfinder.anchor = Anchor.topLeft;

No matter what I try the image will not fill the map area.

enter image description here

0

There are 0 best solutions below