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

Separate GameControl from actions and simplify the logic #39

Merged
merged 5 commits into from Oct 26, 2022

Conversation

jrasanen
Copy link
Contributor

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?

src/actions.rs Outdated Show resolved Hide resolved
src/game_control.rs Outdated Show resolved Hide resolved
src/actions.rs Outdated Show resolved Hide resolved
src/actions.rs Outdated Show resolved Hide resolved
@NiklasEi
Copy link
Owner

NiklasEi commented Oct 25, 2022

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
Copy link
Contributor Author

jrasanen commented Oct 26, 2022

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

Copy link
Owner

@NiklasEi NiklasEi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good.

@NiklasEi NiklasEi merged commit 14c329b into NiklasEi:main Oct 26, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants