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

Implement Input Mapping #52

Merged
merged 1 commit into from
Jul 7, 2022
Merged

Implement Input Mapping #52

merged 1 commit into from
Jul 7, 2022

Conversation

zicklag
Copy link
Member

@zicklag zicklag commented Jul 6, 2022

Here's two players controlled both with gamepads, and keyboard controls work too!

punchy02-players

@odecay odecay mentioned this pull request Jul 6, 2022
3 tasks
@zicklag zicklag force-pushed the input-mapping branch 2 times, most recently from 0689660 to c4f5c87 Compare July 6, 2022 20:25
@zicklag zicklag changed the title DRAFT: Implement Input Mapping Implement Input Mapping Jul 6, 2022
@zicklag zicklag marked this pull request as ready for review July 6, 2022 20:26
@zicklag zicklag force-pushed the input-mapping branch 2 times, most recently from 8f64df8 to 04d2d87 Compare July 6, 2022 21:48
@zicklag
Copy link
Member Author

zicklag commented Jul 6, 2022

@odecay this is ready for review now.

It replaces all game input with mapable actions in three categories: player, camera, and menu. There is no longer any occurrence of KeyCode anywhere in the code, it's all mapped and loaded from the GameMeta asset. :)

You can also play two players, now, though I believe there's a weird bug where the second player cannot move while the first player is flopping. I haven't investigated yet, but I think we can fix that after this PR.

I'm going to follow up with a PR to allow you to navigate the menus with the gamepad, and then after that I'll look into getting two players working without issue.

@odecay
Copy link
Collaborator

odecay commented Jul 6, 2022

Though I believe there's a weird bug where the second player cannot move while the first player is flopping

Maybe its because of something I did in state checking for that system? Using return instead of break? https://github.com/fishfight/punchy/blob/0060a90bd2fed813a0bf5ae06593ec0b914a5ed1/src/main.rs#L664

@odecay
Copy link
Collaborator

odecay commented Jul 6, 2022

it replaces all game input with mapable actions in three categories: player, camera, and menu. There is no longer any occurrence of KeyCode anywhere in the code, it's all mapped and loaded from the GameMeta asset. :)

Awesome! Review + merge will be my first priority after the v0.0.2 release is up today.

I'm going to follow up with a PR to allow you to navigate the menus with the gamepad, and then after that I'll look into getting two players working without issue.

👍 Sounds good!

@erlend-sh erlend-sh added this to the v0.0.3 milestone Jul 7, 2022
- Single:
GamepadButton: East

camera:
Copy link
Collaborator

Choose a reason for hiding this comment

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

i like the defaults here for camera movement

@@ -12,6 +12,161 @@ main_menu:
image: ui/main-menu-background.png
image_size: [1919, 1027]

default_input_maps:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Very nice how clean it is to have analogs + dpad + keyboard all share input maps

#TODO turn this into a debug feature
[patch.crates-io]
# Patch to enable improved DPad support. It's a merge of the following PR to Bevy 0.7.0 so we can
# use it before 0.8 is release: https://github.com/bevyengine/bevy/pull/5220.
Copy link
Collaborator

Choose a reason for hiding this comment

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

checked out the patch, looks relatively simple lets hope it gets merged 👍

@odecay odecay merged commit 044b224 into fishfolk:master Jul 7, 2022
@zicklag zicklag deleted the input-mapping branch July 7, 2022 22:14
@zicklag zicklag mentioned this pull request Jul 14, 2022
3 tasks
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

3 participants