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 Game replay and Quit buttons to Pygame Dots & Boxes - Issue Number 105 #106

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

Conversation

Vivekkaspa
Copy link

@Vivekkaspa Vivekkaspa commented May 30, 2024

Description

This repository contains a Pygame Dots & Boxes game that has been enhanced with replay and quit buttons. These buttons provide users with additional functionality to start a new game or exit the current game. This removes the extra usage of keyboard by players and thus allows to just click on the respective buttons instead of pressing the keys R and Q.

Changes Made : Fixes #105

  1. Replay Button: Added a replay button below the game over message. This button allows users to start a new game after the current game ends. The replay button is displayed with the text "Replay" and has a blue color.

  2. Quit Button: Added a quit button below the replay button. This button allows users to exit the game when clicked. The quit button is displayed with the text "Quit" and has a red color.

  3. Changing Grid size: Changed the grid size to 400X400 i.e SCREEN_WIDTH & SCREEN_HEIGHT to 400 each respectively to ensure proper spacing and padding upon addition of 2 buttons.

Implementation Details

  • Defined rectangles for both the replay and quit buttons.
  • Drawn the buttons on the screen using the draw_button function.
  • Handled mouse click events for both buttons to trigger the corresponding actions (replaying or quitting the game) when clicked.

Testing

  • Tested the functionality of both buttons by clicking on them during the game over phase. Verified that the game either restarted or quit as expected based on the button clicked.

Note

  • This enhancement improves the user experience by providing clear options for restarting or quitting the game, making it more intuitive and user-friendly.

Screenshot (2641)

@Vivekkaspa Vivekkaspa changed the title Added Game replay and Quit buttons to Pygame Dots & Boxes Added Game replay and Quit buttons to Pygame Dots & Boxes - Issue Number 105 May 30, 2024
@Vivekkaspa
Copy link
Author

@shrawani21 please review it and merge the above PR. Thank you! Also add the labels of gssoc and the level to this PR and in the issue. I have been asking for that since I opened issue. Pls try to review the PR and the corresponding issue that got resolved. Thank you :)

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.

Add Game Replay & Quit features as buttons to the existing game
1 participant