Coder Prodigy

Make Your Sprite Jump

Add a jump to your game in five lines of real JavaScript, using the space key.

Test Writer

  • 1 min read
On this page

Start with one or two sentences: what the reader will build or learn, and who the post is for. For example: “In this tutorial you’ll make your sprite jump when you press the space key. You only need to know how to add a sprite.”

Set up your sprite

Every section starts with ##. Never use a single #: that’s reserved for the post’s title, which comes from title: above.

A smaller step

Use ### for steps inside a section. Two or more headings give the post an “On this page” menu automatically.

Write the code

Every code block names its language after the three backticks (js), and only uses real Coder Prodigy functions:

JavaScript
// Jump when the space key is pressed
whenKeyPressed("space", () => {
  repeat(10, () => changeY(8));
  repeat(10, () => changeY(-8));
});

Mention a function inline with single backticks, like changeY(8).

Add a picture

Images go in the post’s images/ folder. Always describe the picture inside the square brackets: that text is read aloud to people who can’t see it.

The sprite in mid-jump above the ground

Play the finished game

Link to a shared Coder Prodigy project so readers can play it or look inside:

Play the finished game

Use a quote block for a short tip the reader shouldn’t miss.

Conclusion

Sum up what the reader built, and suggest what to try next.