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
feat: adding the OOP platformer project to new JS curriculum #50385
base: main
Are you sure you want to change the base?
feat: adding the OOP platformer project to new JS curriculum #50385
Conversation
👀 Review this PR in a CodeSee Review Map |
This reverts commit 9cfce6b.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey Jessica, I know it's a draft, anyway I went through the steps and left some comments.
|
||
# --description-- | ||
|
||
In this project, you are going to learn intermediate Object Oriented principles by building a platformer game. All of the HTML and CSS has been provided for you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add "Programming" in "intermediate Object Oriented principles".
You should create a `const` variable called `gravity` and assign it 0.5 | ||
|
||
```js | ||
assert.match(code, /const\s+gravity\s*=\s*0\.5/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of changing the regex into /const\s+gravity\s*=\s*0?\.5/
so even const gravity = .5
passes the test?
|
||
The next step is to add the logic for increasing or decreasing a player's velocity based on if they move to the left or right of the screen. | ||
|
||
Inside the `animate` function, create an `if` statement where the condition checks if the right key was pressed and the player's position is less than 400. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's obvious but maybe it could be specified "player's x position". At least in the hint.
|
||
# --hints-- | ||
|
||
Your `movePlayer` function should have three parameters called `key`, `xVelocity`, `isPressed`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this has to be the only hint I would change it into:
You should create a movePlayer
arrow function that has three parameters called key
, xVelocity
, isPressed
.
You should have an `if` statement that checks if the `isCheckpointCollisionDetectionActive` is false. | ||
|
||
```js | ||
assert.match(code, /if\s*\(\s*!?\s*isCheckpointCollisionDetectionActive\s*\)\s*{\s*}\s*/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test passes even if isCheckpointCollisionDetectionActive
is true. Also, should we allow something like isCheckpointCollisionDetectionActive === false
to pass?
You should have a `checkpoint` parameter inside the `forEach` callback function. | ||
|
||
```js | ||
assert.match(code, /\s*checkpoints\s*\.\s*forEach\s*\(\s*checkpoint\s*=>\s*{/s); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test passes without adding code.
|
||
# --hints-- | ||
|
||
You should have a `forEach` loop that iterates through the `checkpoints` array. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This passes without adding code.
|
||
You should use the `checkpoint` parameter inside the `forEach` callback function. | ||
|
||
```js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This passes without adding code.
|
||
# --description-- | ||
|
||
Inside the `showCheckpointScreen` function, set the `checkpointScreen` display property to block. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would wrap display in backticks.
You should have a `forEach` loop that iterates through the `checkpoints` array. | ||
|
||
```js | ||
assert.match(code, /\bcheckpoints\b\s*\.\s*forEach\s*\(/s); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This passes without adding code.
chore: merging latest changes from main
merging latest changes from main
Checklist:
main
branch of freeCodeCamp.Closes #XXXXX