Flutter-Buddies / tic_tac_no

Complex variants of tic-tac-toe game
MIT License
19 stars 10 forks source link

Sound plays when tapping on any board square even if it can't be played on #72

Closed Zambrella closed 3 years ago

Zambrella commented 3 years ago

This is expected because of the current implementation as the audio play function just reacts to user press.

One solution would be to move some of the game based audio into the GameBloc but I don't know if that's a good idea?

Maybe we could create a separate Bloc? that subscribes to game events and reacts to them by playing sounds?

slovnicki commented 3 years ago

I think a separate bloc is unnecessary. Indeed, our GameBloc is quite a large bloke already, but it can handle some more responsibilities 😁

The best would be to add TtnAudio into GameBloc in the same manner as the Judge is there. Then the bloc will control when to play sounds (within its mapEventToState) as it controls all other aspects of game flow.

The bloc is like a mastermind that uses Judge and TtnAudio as helpers/delegates to do things for him when needed.

Zambrella commented 3 years ago

Fixed by moving some of the audio logic into the GameBloc and the Judge.