NiklasEi / bevy_game_template

Template for a Bevy game including CI/CD for web, Windows, Linux, macOS, iOS and Android
https://niklasei.github.io/bevy_game_template/
Creative Commons Zero v1.0 Universal
844 stars 89 forks source link

Separate GameControl from actions and simplify the logic #39

Closed jrasanen closed 2 years ago

jrasanen commented 2 years ago

Love this template a lot, but I feel that actions.rs has a lot going on and separation of concerns is in place.

So I created a module for the game control. In my projects, the actions and game_control start to grow soon, so having them in different files, to begin with, is helpful.

The current actions logic is also hard to read and manage. I think if the is_pressed would just return 1.0 or 0.0, the normalized movement can be calculated from Left - Right or Up-Down.

What do you think?

NiklasEi commented 2 years ago

Nice, thank you. A few smaller comments, but I like the idea to split the file.

Maybe game_control should be part of the actions mod (so src/actions/game_control)? It should not be used anywhere else. Other root level files also export bevy plugins, which is not the case here.

jrasanen commented 2 years ago

Good comments, thanks for your time! Made the changes, feel free to also resolve the threads I created.