Home > OS >  Why is HasCollidables mixin not being recognized in FlameGame?
Why is HasCollidables mixin not being recognized in FlameGame?

Time:01-01

In my programm the HasCollidables Mixin is not beeing recognized. When I hover over "HasCollidables" it says "Classes can only mix in mixins and classes. (dartmixin_of_non_class)". I have the up to date Flutter Version (3.3.10) my Flame Version is 1.5.0.

import 'package:flame/geometry.dart';
import 'package:flutter/material.dart';
import 'package:flame/game.dart';
import 'package:flame/components.dart';

void main() {
  var game = MyGame();
  runApp(
    GameWidget(
      game: game,
    ),
  );
}

class MyGame extends FlameGame with HasCollidables {
  Future<void> onl oad() async {
    print('loading assets');
  }

Is something wrong with the code? I saw the exact code running on other machines.

I tried out adding and removing imports to fix the problem and also to update flutter and flame to the newest version, but that didn't help so far.

CodePudding user response:

HasCollidables is deprecated now. You probably want to use HasCollisionDetection mixin. Read the docs here: https://docs.flame-engine.org/1.5.0/flame/collision_detection.html

  • Related