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

completed frogger-task #519

Merged
merged 5 commits into from
Oct 13, 2022
Merged

completed frogger-task #519

merged 5 commits into from
Oct 13, 2022

Conversation

sofiichuk
Copy link
Contributor

@sofiichuk sofiichuk commented Sep 11, 2022

Object Oriented JS

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 😺

@sofiichuk
Copy link
Contributor Author

sofiichuk commented Sep 13, 2022

dear bot, dear mentors.
i guess my code meats most of recommendations.
except:
initial bug positions. i could've pretend calculating, but they are what they are - uncalculatable and inavitable;
also i used player = new Player instead of Object.create;
and maybe i could separate smaller functions - like reset - from win/lose functions. i tried and i lost;
if it's ok - it's ok.
and if i have to improve that - i will

@OleksiyRudenko OleksiyRudenko added the self-check-done Student confirmed that self-checks against requirements/common-mistakes are done label Sep 20, 2022
@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.

@sofiichuk nice start.
Needs improvements.
Pixel values are definitely calculable based on icons dimensions and playfield row numbers.
This would require certain research.
For example, how did you come up with numbers for initialPlayerPosition?
Also how river height is different from cell height?
How did you determine field width and height?

Comment on lines 52 to 56
if (player.x <= this.x + character.width &&
player.x + character.width >= this.x &&
player.y <= this.y + character.height &&
player.y + character.height >= this.y) {
player.reset()
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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

replaced global variable's properties with enemy's own

Comment on lines 131 to 133
const enemy1 = new Enemy(0, 225, 100);
const enemy2 = new Enemy(0, 142, 200);
const enemy3 = new Enemy(0, 60, 150);
Copy link
Member

Choose a reason for hiding this comment

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

Mystery numbers. Item 3 (all subitems) of the requirements.
Also not DRY. Imagine you are tasked to add 10 more enemies. Minimize the effort.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no more mystery numbers.
no mo repetitions.
p.s. also fixed two bugs that had been found during UAT.
p.p.s. please, review .this once again

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.

@sofiichuk global variables seem to be supernatural... while they are not.

this.width = character.width;
this.height = character.height;
this.speed = speed;
this.rival = player;
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 still a global variable.
What blocks you from treating in the same way as you treat speed or coordinates?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

did that

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.

@sofiichuk great job!

@OleksiyRudenko OleksiyRudenko merged commit 166bd6e into kottans:main Oct 13, 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.

3 participants