Skip to content

Add main menu and game over menu to breakout example#2927

Closed
ParthPant wants to merge 4 commits intobevyengine:mainfrom
ParthPant:breakout
Closed

Add main menu and game over menu to breakout example#2927
ParthPant wants to merge 4 commits intobevyengine:mainfrom
ParthPant:breakout

Conversation

@ParthPant
Copy link

This PR adds a main menu and game over menu to the breakout example

  • I have been trying to learn more about bevy and the examples have been of great help. This PR adds more functionality to the breakout example to illustrate the use of events and states while also making the game more realistic by adding "game over" functionality when the ball hits the bottom.
  • I hope that this example will now present a lot of common bevy concepts that required to make a simple game in one place rather that being distributed in different files.

@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Oct 7, 2021
@NiklasEi NiklasEi added C-Examples An addition or correction to our examples S-Needs-Review and removed S-Needs-Triage This issue needs to be labelled labels Oct 7, 2021
@alice-i-cecile
Copy link
Member

I like this! We should probably try to coordinate this with #2094 :)

Copy link

@zimzat zimzat left a comment

Choose a reason for hiding this comment

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

Foreword: I'm just a bevy/rust noob so don't take my word as a given.

I'm definitely in favor of having more comprehensive game examples using states and what-not.

.add_system_set(SystemSet::on_enter(GameState::GameOver).with_system(ui_system_setup))
.add_system_set(SystemSet::on_update(GameState::GameOver).with_system(key_input_system))
.add_system_set(SystemSet::on_exit(GameState::GameOver).with_system(teardown))
.add_system_set(SystemSet::new().with_run_criteria(FixedTimestep::step(TIME_STEP as f64)))
Copy link

Choose a reason for hiding this comment

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

It doesn't look like any systems are running under the timestep system set?

In my very limited experience, combining states or timesteps with any sort of custom run criteria is very difficult. The unofficial cheat book mentions it is possible to combine run criteria use some trickery to get around it but doesn't provide an example yet. Instead I've had to make do with simply moving custom criteria into the actual system itself (e.g. pulling in the active state as a argument) but that doesn't always work.

Copy link
Author

Choose a reason for hiding this comment

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

hmm. I am not really sure about this. I think this should make all the systems run with fixed time step.

FizedTimeStep was first a part of the system set that had all the main game systems but when I added states, it overrode the state execution order. So I had to add this separately.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, the incompatiblity here is really frustrating. This isn't your fault; it's a known serious Bevy limitation. See #2801 for some high-level planning on how we might restructure things to solve this.

@alice-i-cecile
Copy link
Member

Discussed with the docs team. This is great, but I'm going to close it out to keep the Breakout example simple and approachable :) Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-Examples An addition or correction to our examples

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants