2016-03-26 00:47:20 +01:00
|
|
|
# boxer mania challenges
|
|
|
|
|
|
|
|
My script. #docs
|
|
|
|
|
2016-04-13 17:27:45 +02:00
|
|
|
This [guided tutorial](/lessons/boxer-mania/tutorial) will help you create an animation!
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
**Challenge 0**
|
|
|
|
|
|
|
|
Let's create and show a series of frames on the LED screen; this is an animation!
|
|
|
|
|
2016-11-02 01:44:37 +01:00
|
|
|
We will use multiple frames to make it look like a square is rotating on the @boardname@ screen!
|
2016-03-26 00:47:20 +01:00
|
|
|
|
|
|
|
```
|
|
|
|
basic.showAnimation(`
|
|
|
|
. # . . .
|
|
|
|
# . . . .
|
|
|
|
. # . . .
|
|
|
|
. . # . #
|
|
|
|
. . . # .
|
|
|
|
`, 400)
|
|
|
|
```
|
|
|
|
|
|
|
|
**Challenge 1**
|
|
|
|
|
|
|
|
Let's create the next frame to make it look like the square is spinning clock-wise!
|
|
|
|
|
|
|
|
```
|
|
|
|
basic.showAnimation(`
|
|
|
|
. # . . .
|
|
|
|
# . . . .
|
|
|
|
. # . . .
|
|
|
|
. . # . #
|
|
|
|
. . . # .
|
|
|
|
`, 400)
|
|
|
|
basic.showAnimation(`
|
|
|
|
# # # # #
|
|
|
|
# . . . #
|
|
|
|
# . . . #
|
|
|
|
# . . . #
|
|
|
|
# # # # #
|
|
|
|
`, 400) // ***
|
|
|
|
```
|
|
|
|
|
|
|
|
**Challenge 2**
|
|
|
|
|
|
|
|
Add the next two frames to show a complete rotation for the square!
|
|
|
|
|
|
|
|
```
|
|
|
|
basic.showAnimation(`
|
|
|
|
. # . . .
|
|
|
|
# . . . .
|
|
|
|
. # . . .
|
|
|
|
. . # . #
|
|
|
|
. . . # .
|
|
|
|
`, 400)
|
|
|
|
basic.showAnimation(`
|
|
|
|
# # # # #
|
|
|
|
# . . . #
|
|
|
|
# . . . #
|
|
|
|
# . . . #
|
|
|
|
# # # # #
|
|
|
|
`, 400)
|
|
|
|
basic.showAnimation(`
|
|
|
|
. # . . . # # # # #
|
|
|
|
# . # . . # . . . #
|
|
|
|
. . . # . # . . . #
|
|
|
|
. . . . # # . . . #
|
|
|
|
. . . # . # # # # #
|
|
|
|
`, 400) // ***
|
|
|
|
```
|
|
|
|
|
|
|
|
**Challenge 3**
|
|
|
|
|
|
|
|
Do you want to show the same animation with fewer lines of codes? We can do this by combining all the frames into one show animation function call!
|
|
|
|
|
|
|
|
```
|
|
|
|
basic.showAnimation(`
|
|
|
|
. # . . . # # # # # . # . . . # # # # #
|
|
|
|
# . . . . # . . . # # . # . . # . . . #
|
|
|
|
. # . . . # . . . # . . . # . # . . . #
|
|
|
|
. . # . # # . . . # . . . . # # . . . #
|
|
|
|
. . . # . # # # # # . . . # . # # # # #
|
|
|
|
`, 400) // ***
|
|
|
|
```
|
|
|
|
|