Issue
I am trying to factor out some code(inspired from this)
part "game.dart":
part 'taps.dart';
class MyGame extends FlameGame with HasTappables {}
Trying to factor out to this file "taps.dart":
part of 'game.dart';
mixin Taps on MyGame {
@override
void onTapDown(int pointerId, TapDownInfo info) {
super.onTapDown(pointerId, info);
}
Problem is that "onTapDown" is not called?
Update:
This will not work:
class MainClass with OneMixin {
void test(){
helloOne();
}
}
mixin OneMixin on MainClass {
void helloOne() {
test();
}
}
Solution
Something like this would work:
abstract class FlameGame {
int? a;
}
class MyGame extends FlameGame with Taps {
int? b;
}
mixin Taps on FlameGame {
void method() {
print(a); // Possible
print(b); // Not possible
print((this as MyGame).b); // possible but unsave
}
}
Answered By - puaaaal
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.