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

Don't Let Second Player Controls Control AI Players #712

Closed
zicklag opened this issue Mar 13, 2023 · 2 comments · Fixed by #721
Closed

Don't Let Second Player Controls Control AI Players #712

zicklag opened this issue Mar 13, 2023 · 2 comments · Fixed by #721
Labels
good first issue Good for newcomers help wanted Extra attention is needed kind:bug Something isn't working
Milestone

Comments

@zicklag
Copy link
Member

zicklag commented Mar 13, 2023

Right now if you add an AI player for player 2 you can still control them with the keyboard using the player 2 controls. We should make it impossible to control AI players.

@zicklag zicklag added kind:bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels Mar 13, 2023
@lvllvl
Copy link
Contributor

lvllvl commented Mar 13, 2023

  1. do you think this is simply a matter of disabling keys? If so, which keys would be considered player 1? Like is there a preference for which keys to disable?
  2. would I need to make the changes in the player_ai_system function ( core > src > player.rs) or is it located in the input.rs file ( core > src > input.rs ) ?

@zicklag
Copy link
Member Author

zicklag commented Mar 14, 2023

This should actually be super simple. You should just have to do a check here for whether or not the player is an AI, and just continue the loop if they are an AI:

jumpy/src/session.rs

Lines 149 to 150 in cd0fb59

for (player_idx, action_state) in &player_input_collectors {
let control = &mut inputs.players[player_idx.0].control;

Something like:

if inputs.players[player_idx.0].is_ai { continue; }

You shouldn't need to do anything to the player_ai_system or anything else, I don't think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed kind:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants