Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 22514

How to change using code with followComponent method in older version of flame to new one

$
0
0

I am the beginner in flame. I am using code from one of the tutorials. And there is code it provided:

import 'dart:ui';import 'package:flame/game.dart';import 'components/player.dart';import '../helpers/direction.dart';import 'components/world.dart';class RayWorldGame extends FlameGame {  final Player _player = Player();  final World _world = World();  @override  Future<void> onLoad() async {    await add(_world);    add(_player);    _player.position = _world.size / 2;    camera.followComponent(_player,        worldBounds: Rect.fromLTRB(0, 0, _world.size.x, _world.size.y));  }  void onJoypadDirectionChanged(Direction direction) {    _player.direction = direction;  }}

I`ve got an error:

`Error: The method 'followComponent' isn't defined for the class 'CameraComponent'.`

So, how can i change it, if i want to use the latest verson of flame?


Viewing all articles
Browse latest Browse all 22514

Trending Articles