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 Dodge the Blocks game #771

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

Conversation

RudraJy
Copy link

@RudraJy RudraJy commented Oct 21, 2024

Pull Request for PyVerse 💡

Requesting to submit a pull request to the PyVerse repository.


Issue Title

Please enter the title of the issue related to your pull request.
[Code Addition Request]: Add Game Development Project : Dodge the Blocks

  • I have provided the issue title.

Info about the Related Issue

What's the goal of the project?
To add a Dodge the Blocks game created in Python using Pygame.

  • I have described the aim of the project.

Name

Please mention your name.
Rudra Jyotirmay

  • I have provided my name.

GitHub ID

Please mention your GitHub ID.
RudraJy

  • I have provided my GitHub ID.

Email ID

Please mention your email ID for further communication.
[email protected]

  • I have provided my email ID.

Identify Yourself

Mention in which program you are contributing (e.g., WoB, GSSOC, SSOC, SWOC).
Contributor - Hacktoberfest 2024
Contributor - GSSOC 24 : Extended Edition

  • I have mentioned my participant role.

Closes

Enter the issue number that will be closed through this PR.
*Closes: #714

  • I have provided the issue number.

Describe the Add-ons or Changes You've Made

Give a clear description of what you have added or modified.
Added a game in the Game_Development folder.

  • I have described my changes.

Type of Change

Select the type of change:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, local variables)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Describe how your changes have been tested.
Tested on my local system.

  • I have described my testing process.

Checklist

Please confirm the following:

  • My code follows the guidelines of this project.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly wherever it was hard to understand.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • I have added things that prove my fix is effective or that my feature works.
  • Any dependent changes have been merged and published in downstream modules.

Copy link

👋 Thank you for opening this pull request! We're excited to review your contribution. Please give us a moment, and we'll get back to you shortly!

Feel free to join our community on Discord to discuss more!

@ruhi47 ruhi47 added Status: Review Ongoing PR is currently under review and awaiting feedback from reviewers. Contributor Denotes issues or PRs submitted by contributors to acknowledge their participation. level2 gssoc-ext hacktoberfest labels Oct 21, 2024
@UTSAVS26 UTSAVS26 added level1 and removed level2 labels Oct 22, 2024


# Player movement
handle_player_movement(event, player)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The function handle_player_movement(event, player) is called outside the event loop. Due to this only last event is repeating (i.e. Start of the game) and it crashes afterwards. Please update this and will merge once updated.

Copy link
Author

Choose a reason for hiding this comment

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

That won't work. When the handle_player_movement(event, player) function is called inside the event loop, it only processes discrete events. Pygame doesn’t continuously repeat key events while a key is held down, but rather treats it as individual key presses that need to be handled explicitly.

So, what would happen if the function is called inside the event loop?
Continuing to press on an arrow key only moves it by one unit and then it stops. For example if i hold down the down arrow key then the player block moves one unit down and then stops. If i want to move further down, i have to lift up my finger and then press the down key again. This is annoying and not the desired functionality.

Why keep the function outside the event loop?
It keeps checking for the event in every frame, meaning it continually processes movement as long as the key is pressed, which is what you want for smooth movement. This is the desired functionality.

Game_Development/Dodge-the-Blocks/main.py Outdated Show resolved Hide resolved
@ruhi47 ruhi47 added the Status: Requested Changes Indicates that a reviewer has requested changes to a PR before it can be approved. label Oct 23, 2024
Copy link
Collaborator

@TheChaoticor TheChaoticor left a comment

Choose a reason for hiding this comment

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

Please do the requested changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Contributor Denotes issues or PRs submitted by contributors to acknowledge their participation. gssoc-ext hacktoberfest level1 Status: Requested Changes Indicates that a reviewer has requested changes to a PR before it can be approved. Status: Review Ongoing PR is currently under review and awaiting feedback from reviewers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Code Addition Request]: Add Game Development Project : Dodge the Blocks
4 participants