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

Added level loading screen (reference issue #190) #191

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

catprisbrey
Copy link

#190

Created a MasterLevelLoadingMenu class and scene, with added logic to the Master MainMenu. It borrows from the Continue game logic as well as the SceneLister logic.

Levels are propagated into an ItemList, with their file names cleaned. Whatever level is activated, will update the GameStates.current_level to match the level selected. A signal emits which triggers the load action from the main menu.

It tried to keep it minimal, and imitate the style of logic already established.

Created a MasterLevelLoadingMenu class and scene, with added logic to the Master MainMenu. It borrows from the Continue game logic as well as the SceneLister logic.

Levels are propagated into an ItemList, with their file names cleaned. Whatever Level is activated, will update the GameStates.current_level to match the level selected. A signal emits which triggers the load action from the main menu.

It tried to keep it minimal, and imitate the style of logic already established.
@catprisbrey
Copy link
Author

This morning testing more.

I referenced GameState to set the current level, but with testing in other example projects, that reference becomes unavailable, but GameStateExample works.

@Maaack
Copy link
Owner

Maaack commented Dec 27, 2024

Thanks for opening the pull request. I'll have time to test and review in a few days. Short of a critical bug, I'll merge this into main so your contribution is recorded. I'm not sure it'll show up on the front page without GitHub's verification (green check mark next to commits) though. Not sure if that matters to you, but just a heads up.

The GameStateExample is a recent addition and breaks from the project's conventions by adding a class that is purely an example (ie. meant to be re-written rather than inherited). When the example/ folder get's copied, the Example extension is removed and it becomes GameState.

@catprisbrey
Copy link
Author

The various locations of examples scenes and the nuance of some of it I still don't think I grasp. For example, i'm uncertain why when i used GameState it stopped working on my other project, while GameStateExample did. There is just enough going on under the hood on your project that I expect you'll tryout my PR, look it over, and find several things needing to be adjusted.

In my continued testing I also found it handy to grab focus to the ItemList, but that isn't part of this PR. I can drop and resubmit and updated PR if you like, or just hold off until you've had a chance to try this version first. I don't collaborate with other's projects on GitHub enough to know what's best for you.

@Maaack
Copy link
Owner

Maaack commented Dec 27, 2024

Totally understand. The copying process is a little unconventional. GameStateExample should be used inside of addons/.... The expectation is that most people use the plugin version from the Godot Asset Library, and then copy the examples into their project's root folder. The copy process can be tested under Project > Tools.

To grab focus, there is a capture_focus.gd script that can be applied to a Control node, and will grab focus when the first selectable UI element in the tree becomes visible. Feel free to add it to your level select scene.

Focus is now grabbed by the auto-capture container. Also the GameState.set_current_level(index) has been changed to "GameStateExample.set_current_level(index)".
 ... to allow for longer level names.
@catprisbrey
Copy link
Author

Made the changes, so the scene now uses the capture_focus container node. The LevelSelect screen now uses the GameStateExample to set the new current level before loading it instead of GameState.
I'm going to test these changes more on my own project and ensure there aren't any major issues with it, but so far so good it seems.

I found on repeat loads-- returning to the main menu and opening the level select scree -- the focus wouldn't grab and options weren't selectable. I replaced it with a simple manual solution to at input detect if visible and lacking focus.

I found this worked more consitently with Mouse/Gamepad too.
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