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

Frogger #479

Merged
merged 4 commits into from
Sep 21, 2022
Merged

Frogger #479

merged 4 commits into from
Sep 21, 2022

Conversation

IhorOzerov
Copy link
Contributor

Frogger game

Demo |
Code base

The code is submitted in a dedicated feature branch.

Only code files are submitted.

Please, review.

@github-actions
Copy link

github-actions bot commented Sep 8, 2022

Hey!

Congratulations on your PR! 😎😎😎

Let's do some self-checks to fix most common issues and to make some improvements to the code before reviewers put their hands on the code.

Go through the requirements/most common mistakes linked below and fix the code as appropriate.

If you have any questions to requirements/common mistakes feel free asking them here or in Students' chat.

When you genuinely believe you are done put a comment stating that you have completed self-checks and fixed code accordingly.

Also, be aware, that if you would silently ignore this recommendation, a mentor can think that you are still working on fixes. And your PR will not be reviewed. 😒

Please, make sure that your code follows the requirements

Universal recommendations:

  • Make sure your code follows General Requirements
  • Use common sense or seek for an advice whenever requirements look ambiguous or unclear.

By the way, you may proceed to the next task before this one is reviewed and merged.

Sincerely yours,
Submissions Kottachecker 😺

fixed: assignment of constants, separation of functions
@IhorOzerov
Copy link
Contributor Author

I have completed self-checks and fixed code accordingly. Please, check it.

@OleksiyRudenko OleksiyRudenko added the self-check-done Student confirmed that self-checks against requirements/common-mistakes are done label Sep 20, 2022
Copy link
Member

@OleksiyRudenko OleksiyRudenko left a comment

Choose a reason for hiding this comment

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

@IhorOzerov good start.
However, not all requirements are met.
If anything is not clear feel free asking questions in Students' chat.

Comment on lines 80 to 81
player.x = config.PLAYER_CONST.x;
player.y = config.PLAYER_CONST.y;
Copy link
Member

Choose a reason for hiding this comment

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

Class definition should not refer a specific instance of the class.
There are means to refer to properties you actually use. Why this? (not a rhetoric question)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved the character with coordinates and chose these two points for myself.

Copy link
Member

Choose a reason for hiding this comment

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

Class definition should not refer a specific instance of the class.

Why do you do this? You will be closer to the solution once you figure out what forces you to take this approach.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i am renamed specific instance, please check.
i am not pretty sure am i understand

Copy link
Contributor Author

Choose a reason for hiding this comment

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

am i need to make some constants like a math decision, but not like "i am decided that"?
or there is problem exactly in specific instance?

Copy link
Member

Choose a reason for hiding this comment

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

Is "i decided that" equivalent to "i just guessed and it works"?
Calculations provide explanations. As a developer tasked to contribute to a project developed before by someone else (often previous contributors are unreachable as people tend to quit companies) you will want to understand what is going on in the code, why and what is behind numbers in particular.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Second option will be closer to truth.
After this fixes i am better see how prototype works and where it similar to class sintax. Thank you!

Comment on lines 45 to 53
const playerWidth = player.x + config.PLAYER_CONST.width;
const playerHeight = player.y + config.PLAYER_CONST.height;

if (player.x < enemyWidth &&
playerWidth > this.x &&
player.y < enemyHeight &&
playerHeight > this.y) {
player.x = config.PLAYER_CONST.x;
player.y = config.PLAYER_CONST.y;
Copy link
Member

@OleksiyRudenko OleksiyRudenko Sep 20, 2022

Choose a reason for hiding this comment

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

Requirements posted/linked by bot addresses specifically the issue we have in this fragment.
Please identify the requirement, post it here as a comment and fix code accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Classes do not refer to any global variables, like global variable player, which is an instance of Player class (referring to global constants and globals provided by the gaming platform like Resources is OK); Hint: pass instance of a game object (or objects) as an argument to other game objects they need to interact with.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, that a relevant requirement. Fix the code accordingly.
You may have the very same issue elsewhere in the code. This is just an example that happened to match this fragment, but the issue is described before the example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

already fixed it, check please

@OleksiyRudenko OleksiyRudenko self-assigned this Sep 20, 2022
Copy link
Member

@OleksiyRudenko OleksiyRudenko left a comment

Choose a reason for hiding this comment

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

Further comments on discussions.

Comment on lines 45 to 53
const playerWidth = player.x + config.PLAYER_CONST.width;
const playerHeight = player.y + config.PLAYER_CONST.height;

if (player.x < enemyWidth &&
playerWidth > this.x &&
player.y < enemyHeight &&
playerHeight > this.y) {
player.x = config.PLAYER_CONST.x;
player.y = config.PLAYER_CONST.y;
Copy link
Member

Choose a reason for hiding this comment

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

Yes, that a relevant requirement. Fix the code accordingly.
You may have the very same issue elsewhere in the code. This is just an example that happened to match this fragment, but the issue is described before the example.

Comment on lines 80 to 81
player.x = config.PLAYER_CONST.x;
player.y = config.PLAYER_CONST.y;
Copy link
Member

Choose a reason for hiding this comment

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

Class definition should not refer a specific instance of the class.

Why do you do this? You will be closer to the solution once you figure out what forces you to take this approach.

improved refer to global variable 'player' in Enemy's and Player's methods
Copy link
Member

@OleksiyRudenko OleksiyRudenko left a comment

Choose a reason for hiding this comment

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

@IhorOzerov great job!

@OleksiyRudenko OleksiyRudenko merged commit 700c384 into kottans:main Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
self-check-done Student confirmed that self-checks against requirements/common-mistakes are done task-Frogger
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants