Skip to content

feat: create a pong prototype #865

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

Merged
merged 16 commits into from
Aug 4, 2025

Conversation

a2937
Copy link
Member

@a2937 a2937 commented Jul 10, 2025

Checklist:

Closes #790

My take on the project mostly works. The computer player's paddle goes up and down unnaturally; and I'm not quite so sure how to fix it.

Additionally the ball sometimes gets stuck on the paddle; thus causing a glitch where the player scores.

@a2937 a2937 changed the title Feat/create pong prototype feat: create a pong prototype Jul 10, 2025
@jdwilkin4
Copy link
Contributor

The computer player's paddle goes up and down unnaturally; and I'm not quite so sure how to fix it.

Additionally the ball sometimes gets stuck on the paddle; thus causing a glitch where the player scores.

I would suggest taking a look at the current solution and seeing how they approached it.

@a2937 a2937 marked this pull request as ready for review July 13, 2025 00:34
@a2937
Copy link
Member Author

a2937 commented Jul 13, 2025

I've not scored against the computer paddle yet. I think we're good?

Copy link
Contributor

@jdwilkin4 jdwilkin4 left a comment

Choose a reason for hiding this comment

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

I was able to test it out locally and play the game and here are my thoughts.

While I wasn't able to beat the computer, I feel like the computer motion is still to much. We should replicate the behavior found in the original demo project here. The original slightly adjusted its position when necessary whereas here I felt here it was constantly moving.

https://codepen.io/satyamdev/full/pdMmBp

Also we should have the ability for users to move the mouse to control the paddle like in the original. I wasn't able to do that here.

Another thing, the paddle should not be able to move completely off screen. In the original, you were able to move it partially off screen but not completely.

Lastly, there should be some better messaging for when the game resets. Right now the scores automatically reset when you click the reset button. But I feel like that could be easily missed. When I first clicked on the button I didn't notice that the game had reset but the paddle where still moving. A nicer user experience would be if there was some sort of modal that maybe asks if you are sure to reset the game. And if so, then they can start a new game or resume the one they have.

Hope all of that helps 👍🏾

@jdwilkin4 jdwilkin4 added awaiting update coding challenges These are for issues targeting the revamped take home projects seciton. labels Jul 25, 2025
@a2937
Copy link
Member Author

a2937 commented Jul 26, 2025

While I wasn't able to beat the computer, I feel like the computer motion is still to much. We should replicate the behavior found in the original demo project here. The original slightly adjusted its position when necessary whereas here I felt here it was constantly moving.

I'm still having trouble figuring out what you mean. I know there's a difference. But I see the computer paddle moving near constantly like mine.

2025-07-26.15-22-49-1.webm

@jdwilkin4
Copy link
Contributor

jdwilkin4 commented Aug 3, 2025

Here is what I am seeing between the current demo and your project.

The current demo is smoother is more reactionary. Here is an example where I am completely still and the computer only moves slightly into position to beat me.It moves into place but its smooth.

demo-project.mov

Whereas with yours, it is constantly moving up and down even when I am stationary. It seems more frantic than natural.

Screen.Recording.2025-08-03.at.1.22.13.PM.mov

So we want to incorperate some of that smoothess the original had. I would suggest reviewing the source code to see how they got it to be smoother. 👍🏾

Also, all of this will take a back seat for now until the TypeScript stuff is done 👍🏾

@a2937 a2937 requested a review from jdwilkin4 August 4, 2025 18:32
Copy link
Contributor

@jdwilkin4 jdwilkin4 left a comment

Choose a reason for hiding this comment

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

I spent some time playing around with it and realized the ball speed was a little fast which made it seem like the paddles were moving frantically. So I slowed that down.

I also pushed up commits for the following:

  • custom reset modal
  • removed instances of var
  • removed unused variables

Played the game for a while and I think it looks good. Thanks for all of your hard work on this. Let's merge it in 👍🏾

@jdwilkin4 jdwilkin4 merged commit 89ad068 into freeCodeCamp:main Aug 4, 2025
1 check passed
@a2937 a2937 deleted the feat/create-pong-prototype branch August 4, 2025 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
coding challenges These are for issues targeting the revamped take home projects seciton.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add prototype for pong game
2 participants