I have some questions. I'm working over app which uses Flame Engine in Expanded Widget as a part of bigger application. So Flame is used only as graphic representation of buttons and for interaction.
Now, theoretically:
- Is it possible to send variable value from flame to regular Text widget in my app? (I know I can read initial value which is 0, but then nothing happends even if console shows incrementing value) Should I write some kind of stream for Flame and future in main app, or is there any other option?
- How can I manage views in flame? I mean that currently I have two different backgrounds and different animations for each. On the bottom of the screen in main app in flutter i have buttons which i would like to use to change flame background and animations as needed (simple response from flame to my buttons)
As for code, my counter in app looks like this:
...
Column(
children: [
Text('show 1'),
Text(_firstCounter.toString())
],
),
...
void CountersAndOthers() async {
if(_gameInProgress == true){ return; }
_gameInProgress = true;
_testGame = new TestGame();
_firstCounter = _testGame.counterNumeroUno;
}
And in Flame it's a simple onTap() function that increment int counter:
@override
void onTap() async {
counter++;
print(counter);
jump();
_timer.start();
}