-
-
Notifications
You must be signed in to change notification settings - Fork 123
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 R key to reset game #350
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I love the refactor in shrink_bounds()
.
IIRC what I wanted to do with this game was show a quick "game over" message and then automatically reset after a few seconds. It looks like you did the hard part implementing a reset method.
I'll accept this, but it would be a "more professional" looking game with the game over screen and not requiring the player to reset with a button.
self.shields = (0..4) | ||
.map(|i| Shield { | ||
sprite: Sprite::new(&self.assets, Frame::Shield1), | ||
pos: Point::new(i * 45 + 32, 192), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably move these magic numbers to const
values at global (module) scope. If they need to be reused in multiple modules, we can create a crate::consts
module for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -165,6 +169,11 @@ fn main() -> Result<(), Error> { | |||
return; | |||
} | |||
|
|||
// Reset game | |||
if g.game.input.key_pressed(VirtualKeyCode::R) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a binding for controller inputs as well. Maybe the "select" button? I don't actually know what it's called any more on XBox/PS/Switch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the "select" button? I don't know!LOL ; )
But I believe that if add the selected operation interface, this problem will be solved!
Yes, I also like
Yes, I agree with you! Show game_over, adding a selection button interface will give users better interaction! This is what I want too! For more professional games, you can also consider adding score and explosion effects... But it is still a challenge for me now ; ) |
This was partially implemented a long time ago in #18! I was never quite satisfied with the way collision shapes are managed in that PR. This and some sound effects make the game really enjoyable. |
Nice! |
There's a button to request reviews which will clear that status. I'll get to the review in the morning! |
Should I just click on it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good! Are you planning to continue working toward the "game over" screen in this PR, or do you prefer this to be merged as it is? I'm ok even with the latter, but it seems kind of "half baked" to stand on its own.
I would just like a sense of what your plans are.
Yes, I think I know what you mean! Hmmm...my thought was to merge first! Because I am still at work, I usually only consider dealing with open source work when I have enough time on weekends! In this process, I don’t want to have a PR hanging in my heart all the time. Maybe I saw some parts that can be modified, or parts that can be optimized in the community, so I would consider participating in it! Just like the PR I submitted, I only want to do "Added R key to reset game" at the moment, maybe it may look like "half baked" at the moment! Don't worry about merging this PR! Maybe there will be another "me" to realize the "game over" function. Of course, if I realize it, I will submit a PR without hesitation. I am very happy to contribute my meager strength to the community! Thank you also for your valuable advice, which gave me a lot of direction! I have learned a lot from cooperating with you, thank you very much! |
Thank you for your contribution! It is objectively an improvement, even if it is not exactly what we want. :) |
Thank you for making a decision, things need to be perfected step by step, excellent products also need to come from constant polishing! Maybe someday I will find out that "Added R key to reset game" is wrong, and I will improve it too! Both we and our products need to undergo continuous self-improvement and self-iteration, so that we can grow slowly and become better slowly! ; ) |
Hi guys, I added a
reset_game
method to the example invaders.When the game is over, you can use the
R
key to reset!And use the
min
function instead of the if function expression!