Skip to content

Documented Pong.java - #1

Open
jonsambro wants to merge 1 commit into
lw:masterfrom
jonsambro:master
Open

Documented Pong.java#1
jonsambro wants to merge 1 commit into
lw:masterfrom
jonsambro:master

Conversation

@jonsambro

Copy link
Copy Markdown

Hi there, I wrote documentation for this project as part of a school assignment. I'd be thrilled if you merged it into your project.

Cheers!

@lw lw left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for your contribution, and sorry it took me so long to get back to you. I added some comments, I've been a bit picky, do the best you can, don't worry too much. :)

Comment thread Pong.java
private static final int SPEED = 12;

/**
* Height of the paddle.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This is half the height of the paddle.

Comment thread Pong.java
* @param player
*/
private void computeDestination (Player player) {
int base; //Unused

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Nice catch; please remove this variable entirely.

Comment thread Pong.java
* @param player Player who's paddle moves.
* @param destination Destination to move the paddle to. If the destination is further than the speed of the paddle
* allows, the paddle will travel the furthest distance possible in one frame.
*/private void movePlayer (Player player, int destination) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Add a newline between end of commend and method.

Comment thread Pong.java
* Computes the destination of the paddle for the next frame depending on which type of player is moving the
* current paddle.
* @param player
*/private void computePosition (Player player) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Same here.

Comment thread Pong.java
* current paddle.
* @param player
*/private void computePosition (Player player) {
//If the player type is mouse, move the paddle towards the mouse cursor.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Add a space at the beginning of the comment. (Applies also to several other comments below).

Comment thread Pong.java
// Prepara il campo di gioco
// If this is the first frame to be rendered.
if (new_game) {
//Place the ball in the center of the screen

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Align properly. (Applies to following comments as well.)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I think the problem is that you've been using spaces whereas the original code has tabs. Please convert to tabs.

Comment thread Pong.java
ball_y = getHeight () / 2;



Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Remove one of these lines.

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.

2 participants