在我试图制作的一款游戏中,瓷砖之间似乎有闪烁的白线.只有当我在移动时,闪烁的线条才会出现,因为相机正在移动.我正在使用:
Flutter :3.16.5
火焰:^1.13.1 Flam_forge2d:^0.16.0+3 FLAME_AUDIO:^2.1.6 火焰平铺:^1.18.2
我在之前的项目中使用了几乎相同的代码,在Android版本中没有遇到这个问题.然而,这一次,随着最新版本的一切,我在Android版本中面临着这个问题.我知道这在Web构建中很常见,我以前在Web上遇到过这个问题,但这是我第一次在Android中面对这个问题.如有任何帮助,我们将不胜感激!
flicker of white line after first platform block
flicker of white lines on tallest of stairs
class MapLevel extends Component with HasGameRef<MainGame> {
MapLevel({required this.level}) : super();
int level;
late Vector2 mapSize;
@override
FutureOr<void> onLoad() async {
TiledComponent map = await TiledComponent.load(
'map$level.tmx', Vector2.all(32) / 10,
priority: 20);
add(map);
mapSize = map.scaledSize;
final spawnLayer = map.tileMap.getLayer<ObjectGroup>('spawn');
final platformLayer = map.tileMap.getLayer<ObjectGroup>('platforms');
for (final platform in platformLayer!.objects) {
game.world.add(Platform(
position: Vector2(platform.x / 10, platform.y / 10),
size: Vector2(platform.width / 10, platform.height / 10),
));
}
for (final spawn in spawnLayer!.objects) {
if (spawn.class_ == 'player') {
var player = Player(
spawnPosition: Vector2(spawn.x / 10, spawn.y / 10),
size: Vector2(spawn.width / 10, spawn.height / 10) * 0.8);
await game.world.add(player);
game.player=player;
game.camera.follow(player);
}
}
game.camera.viewfinder.zoom = (game.canvasSize.x / mapSize.y);
// game.player?.cameraFollow();
return super.onLoad();
}
}