This commit is contained in:
Peli de Halleux 2016-06-17 13:55:55 -07:00
commit 73d18c8d39
2 changed files with 28 additions and 17 deletions

View File

@ -1,6 +1,7 @@
# Create Image # Create Image
Create an [Image](/reference/images/image) to show on the [LED screen](/device/screen). Make an [image](/reference/images/image) (picture) for the micro:bit
[LED screen](/device/screen).
```sig ```sig
images.createImage(` images.createImage(`
@ -12,24 +13,34 @@ images.createImage(`
`) `)
``` ```
### Example: rock, paper, scissors ### Example: Flip-flopping arrow
The following example shows one of three images (rock, paper, or scissors) when you shake the micro:bit: If you press button `A`, this program will make a picture of an
arrow and show it on the LED screen. If you press button `B`, the
program will show a picture of the button upside-down.
``` ```blocks
input.onGesture(Gesture.Shake, () => { input.onButtonPressed(Button.A, () => {
let rockpaper = images.createImage(` images.createImage(`
. . . . . # # # # # . . . . # . . # . .
. # # # . # . . . # # # . # . . # # # .
. # # # . # . . . # . # # . . # . # . #
. # # # . # . . . # # # . # . . . # . .
. . . . . # # # # # . . . . # . . # . .
`) `).showImage(0);
rockpaper.showFrame(Math.random(3)) });
}) input.onButtonPressed(Button.B, () => {
images.createImage(`
. . # . .
. . # . .
# . # . #
. # # # .
. . # . .
`).showImage(0);
});
``` ```
### See also ### See also
[show animation](/reference/basic/show-animation), [image](/reference/images/image), [show image](/reference/image/show-image), [scroll image](/reference/image/scroll-image) [Getting Started](/reference/getting-started), [image](/reference/images/image), [show image](/reference/image/show-image),
[scroll image](/reference/image/scroll-image), [show animation](/reference/basic/show-animation)

View File

@ -1,6 +1,6 @@
{ {
"name": "pxt-microbit", "name": "pxt-microbit",
"version": "0.2.171", "version": "0.2.172",
"description": "BBC micro:bit target for PXT", "description": "BBC micro:bit target for PXT",
"keywords": [ "keywords": [
"JavaScript", "JavaScript",