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

1.6 KiB

snowflake fall challenges

These challenges will allow you to make an exploding rectangle. #docs

Challenge 0

@video vimeo/134649147

This guided tutorial will help you create a snowflake animation!

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

Challenge 1

@video vimeo/134649148

Let's begin creating our falling effect by adding another snowflake with show animation that displays a different snowflake pattern after the first one.

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

Challenge 2

@video vimeo/134649149

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

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

Challenge 3

If you notice, we have three basic->show animation() functions. Try to create the snowflake fall effect by just using one basic->show animation().