pxt-calliope/docs/reference/js/lessons/snowflake-fall/challenges.md
2016-03-25 16:47:20 -07:00

1.3 KiB

snowflake fall challenges

Coding challenges for the snowflake fall tutorial. #docs

Before we get started

Complete the snowflake fall activity and your code will look like this:

basic.forever(() => {
    basic.showAnimation(`
. . . . .
. . # . .
. # # # .
. . # . .
. . . . .
`, 400)
})

Challenge 1

@video td/videos/snowflake-fall-1

Let's begin creating our falling effect by adding another snowflake with basic->show animation that displays a different snowflake pattern after the first one. We need 2 frames in the new animation that display both the first and the second snowflake images.

basic.forever(() => {
    basic.showAnimation(`
. . . . . . . # . .
. . # . . . # . # .
. # # # . # . . . #
. . # . . . # . # .
. . . . . . . # . .
`, 400) // ***
})
  • Run your program to see the cool animation.

Challenge 2

@video td/videos/snowflake-fall-2

To finalize our snowflake fall, let's add a different snowflake pattern.

basic.forever(() => {
    basic.showAnimation(`
. . . . . . . # . . . # . # .
. . # . . . # . # . # # . # #
. # # # . # . . . # . . . . .
. . # . . . # . # . # # . # #
. . . . . . . # . . . # . # .
`, 400) // ***
})
  • Run your program and see if it works.

Challenge 3

Add a fourth frame to the current animation... or make it your own!