Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(bug) The player keeps moving when the TalkDialog is called #271

Closed
TaylorHo opened this issue Jul 9, 2022 · 5 comments
Closed

(bug) The player keeps moving when the TalkDialog is called #271

TaylorHo opened this issue Jul 9, 2022 · 5 comments

Comments

@TaylorHo
Copy link
Contributor

TaylorHo commented Jul 9, 2022

Introducing the bug

When approaching some items on the map, I call TalkDialog.show to show an interactive dialog with the item.
When used on non-mobile platforms (such as web and desktops), when displaying dialog, KeyboardDirectional crashes and keeps the player moving nonstop.

Way to prevent (which still needs improvement)

To prevent this, you can use gameRef.player?.stopMoveAlongThePath();, but as soon as the dialog closes and the player starts walking again, it locks the direction again, moving indefinitely.

Additional Info

It is worth mentioning that the error only occurs with KeyboardDirectional on the joystick (used on the web, Windows, Linux, and macOS).


Example:

    // Stop the player (this line is needed bc without it, the player movement locks on the last used direction)
    gameRef.player?.stopMoveAlongThePath();

    // Show the Dialog
    TalkDialog.show(
      context,
      [
        Say(
          text: [
            TextSpan(
              text: 'example text',
            ),
          ],
        ),
      ],
    );

    // After closing the dialog, no matter which direction you go, the player keeps going in the last direction (from before the dialog) + the direction chosen now
    // Example: Last used direction is [up], and the direction chosen after the dialog end is [right], then, the player will go to up + right direction (diagonal).
    // The direction only returns to normal after going in the same direction the player had gone before the crash (going in the same direction as before the dialogue results in an "unlock" of the direction)

Final considerations

Here we have two changes to be made/fixed:

  • Automatically stop player when some dialog is shown;
  • Fix the lock of the player's direction, after the end of the dialog.

Thanks a lot!

@RafaelBarbosatec
Copy link
Owner

Hi @TaylorHo !
Thanks for this report.
I'm still trying to reproduce. I haven't been able to catch it yet.

@TaylorHo
Copy link
Contributor Author

Ohh, Ok!
I'll try to send here a minimal reproducible project/code, demonstrating the bug.

@TaylorHo
Copy link
Contributor Author

Reproducible Code

Download the compressed project attached below, run the flutter pub get, and then, run the web version of the project (usually flutter run -d chrome).
Just remembering that the error only occurs on desktop platforms, such web.

I've added a better explanation at the lib/fire.dart file (where the TalkDialog is shown).

example.zip

@rafaelbarbosadrip
Copy link

rafaelbarbosadrip commented Jul 18, 2022

Great!
can see this bug now! 😊 Thanks!

@rafaelbarbosadrip
Copy link

Fixed in version 2.6.4. Pls use gameRef.player?.idle(); to stop player.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants