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-api-task #532

Merged
merged 4 commits into from
Sep 29, 2022
Merged

Frogger-api-task #532

merged 4 commits into from
Sep 29, 2022

Conversation

Conversee12
Copy link
Contributor

frogger-api-task

Demo |
Code base

The code is submitted in a dedicated feature branch.

Only code files are submitted.

Please, review.

@github-actions
Copy link

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 😺

@Conversee12
Copy link
Contributor Author

I've completed self-checks, did'nt find any common errors

@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.

@Conversee12 good job. Although further improvements are required.
The comments below refer items from the requirements

Comment on lines 20 to 23
if (this.x < player.x + 80 && this.y < player.y + 60 && this.x + 80 > player.x && this.y + 60 > player.y) {
setTimeout(function () {
player.x = 202;
player.y = 400;
Copy link
Member

Choose a reason for hiding this comment

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

Item 4.iii of the requirements.
Also item 3 (all subitems) of the requirements.

};

let allEnemies = [];
let eachEnemies = [56, 140, 223];
Copy link
Member

Choose a reason for hiding this comment

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

Item 4 (all subitems) of the requirements

Comment on lines 74 to 75
player.x = 202;
player.y = 400;
Copy link
Member

Choose a reason for hiding this comment

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

Item 4.iii of the requirements. Also why refer to class properties via class instance in the context of class definition?
Also item 3 (all subitems) of the requirements.
Also repetition (item 2 of the requirements).

@Conversee12
Copy link
Contributor Author

I hope i understood correctly this changes

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.

@Conversee12
Feel free asking questions if anything is not clear

Comment on lines 34 to 37
if (this.x < player.x + PlayerWidth && this.y < player.y + PlayerHeight && this.x + PlayerWidth > player.x && this.y + PlayerHeight > player.y) {
setTimeout(function () {
player.x = InitialPosition_X;
player.y = InitialPosition_Y;
Copy link
Member

Choose a reason for hiding this comment

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

player is a global variable. 4.iii provides a hint on how to fix the issue.

@Conversee12
Copy link
Contributor Author

image
Is this "allEnemies" a global variable? (if yes) Honestly, i don't know how to change this. Please, explain.

@OleksiyRudenko
Copy link
Member

image Is this "allEnemies" a global variable? (if yes) Honestly, i don't know how to change this. Please, explain.

Original requirement referred specifically to classes definitions, but yes, writing clean functions (functions that use only what is passed to them explicitly via parameters) is a good practice. What blocks you to re-use your experience with global player?

You do not need to fix this.

@OleksiyRudenko
Copy link
Member

OleksiyRudenko commented Sep 27, 2022

setTimeout(function () {
            player.x = InitialPosition_X;
            player.y = InitialPosition_Y;
})

Check what makes arrow functions different from regular functions. setTimeout is a classic example where arrow functions really help.

@Conversee12
Copy link
Contributor Author

image Is this "allEnemies" a global variable? (if yes) Honestly, i don't know how to change this. Please, explain.

Original requirement referred specifically to classes definitions, but yes, writing clean functions (functions that use only what is passed to them explicitly via parameters) is a good practice. What blocks you to re-use your experience with global player?

You do not need to fix this.

Something went wrong, I'll try again to figure it out myself

@Conversee12
Copy link
Contributor Author

setTimeout(function () {
            player.x = InitialPosition_X;
            player.y = InitialPosition_Y;
})

Check what makes arrow functions different from regular functions. setTimeout is a classic example where arrow functions really help.

Read an article about this; understood and corrected

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.

@Conversee12 great job!

@OleksiyRudenko OleksiyRudenko merged commit da41cee into kottans:main Sep 29, 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