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

Updated State system (Bevy 0.12) #245

Open
flatypus opened this issue Nov 6, 2023 · 0 comments
Open

Updated State system (Bevy 0.12) #245

flatypus opened this issue Nov 6, 2023 · 0 comments
Labels
C-outdated Outdated info in book S-programming Core bevy APIs / programming patterns

Comments

@flatypus
Copy link

flatypus commented Nov 6, 2023

Adding on to #238

Defining enum for the game, with #[default] defining the initial state

#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Hash, States)]
enum GameStates {
	#[default]
	GameStart,
	Loading,
	InGame,
	...
}

When setting the state on init, use:

App::new()
	.add_state::<GameStates>()

and the state will be set automatically to default (GameStart)

Rest of the changes in the issue linked are up to date as far as I know.

@inodentry inodentry added S-programming Core bevy APIs / programming patterns C-outdated Outdated info in book labels Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-outdated Outdated info in book S-programming Core bevy APIs / programming patterns
Projects
None yet
Development

No branches or pull requests

2 participants