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

Feature/adding controls options #59

Merged

Conversation

xFranco99
Copy link

Added the controls settings menu

image

@hdescottes hdescottes force-pushed the feature/adding-controls-options branch from 3b2abe8 to 55b541b Compare March 18, 2024 22:47
@xFranco99
Copy link
Author

Hi :),
Thanks for the suggestions, I really appreciate that. The crashes are strange I'll take a closer look

giglio added 5 commits March 19, 2024 23:54
… into feature/adding-controls-options

# Conflicts:
#	core/src/main/java/com/gdx/game/common/UtilityClass.java
#	core/src/main/java/com/gdx/game/screen/OptionScreen.java
#	core/src/main/resources/settings/keys.json
@xFranco99
Copy link
Author

Those fix should have resolved the reported bug, I hope :)

Copy link
Owner

@hdescottes hdescottes left a comment

Choose a reason for hiding this comment

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

Well done overall !
You are almost there, only a few things left :)

I just commited small fixes on imports and typo so you don't have to bother with them.

optionTable = createTable();
handleControlButton();
if (gameState == null) handleControlButton();
Copy link
Owner

Choose a reason for hiding this comment

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

i want to keep the possibility that the player can update his settings while playing, so no if condition :)

TextField quitText = new TextField(
Input.Keys.toString(Integer.parseInt(playerControlsNew.get(InputComponent.Keys.QUIT.name()))), skin);

playerControlsNew = mapInverter(playerControlsNew);
Copy link
Owner

Choose a reason for hiding this comment

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

what is the use of this mapInverter and the one line 129?
do you need the two of them?

core/src/main/java/com/gdx/game/screen/GameScreen.java Outdated Show resolved Hide resolved
HashMap<String, String> controlMap;

try {
controlMap = json.fromJson(HashMap.class, Gdx.files.local(PARTIAL_CONTROLS_SETTINGS_PATH));
Copy link
Owner

Choose a reason for hiding this comment

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

as you are loading the controls from a file you created in the same game session, the new controls are not activate unless you restart the game (that's probably why you added an if condition on the control settings page in game).

Copy link
Author

Choose a reason for hiding this comment

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

Is not necessarily to restart application cause I've added the save of the json in the back button 👍

Copy link
Owner

@hdescottes hdescottes Mar 21, 2024

Choose a reason for hiding this comment

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

indeed it saves the changes, but my point is that the controls are not applied in the current play session it seems.

For example, if i have "W" to move forward and i rebind to "U", i then start or load a game, i will still have "W" as the key to move forward.
If i relaunch the app and start/load a game without touching the controls, i will have the "U" key bind to move forward.

Copy link
Author

Choose a reason for hiding this comment

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

You have right, I'm sorry. I'll fix that asap :)

…at force to restart the game for apply controls changes
@hdescottes
Copy link
Owner

Well done !

@hdescottes hdescottes merged commit 4062168 into hdescottes:master Mar 23, 2024
1 check passed
@xFranco99 xFranco99 deleted the feature/adding-controls-options branch March 23, 2024 12:59
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.

2 participants