More snippet types
This commit is contained in:
parent
9ebd9d4f04
commit
1164feb754
@ -62,7 +62,7 @@ export function newAction() {
|
||||
|
||||
Now let's implement `PRESS PIN 0` in the main. Create a condition of `input->on pin pressed("P0")` that will add one to the score and calls the method `new action`.
|
||||
|
||||
```
|
||||
```blocks
|
||||
// **. . .**
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
basic.showNumber(game.score(), 150) // ***
|
||||
|
@ -39,7 +39,7 @@ coll.push("cat")
|
||||
|
||||
## 4. Write the five (5) lines of code that will add the following five words to `data->coll`: puppy, clock, night, cat, cow.
|
||||
|
||||
```
|
||||
```ts
|
||||
let coll = (<string[]>[])
|
||||
```
|
||||
|
||||
|
@ -6,7 +6,7 @@ Display an [Image](/reference/images/image) on the BBC micro:bit's [LED screen](
|
||||
|
||||
### JavaScript
|
||||
|
||||
```
|
||||
```sig
|
||||
export function plotFrame(_this: micro_bit.Image, index: number)
|
||||
```
|
||||
|
||||
@ -20,7 +20,7 @@ The `plot frame` function takes the index of the frame (if there are two frames,
|
||||
|
||||
### Example
|
||||
|
||||
```
|
||||
```blocks
|
||||
let img = images.createImage(`
|
||||
# . . . # # . . . #
|
||||
. # . # . . # # # .
|
||||
|
@ -6,7 +6,7 @@ Display an [Image](/reference/images/image) on the BBC micro:bit's [LED screen](
|
||||
|
||||
### JavaScript
|
||||
|
||||
```
|
||||
```sig
|
||||
export function plotImage(_this: micro_bit.Image, xOffset: number)
|
||||
```
|
||||
|
||||
@ -20,7 +20,7 @@ The `show image` function has a built in delay of 400ms after display of the ima
|
||||
|
||||
### Example
|
||||
|
||||
```
|
||||
```blocks
|
||||
let img = images.createImage(`
|
||||
# . . . # # . . . #
|
||||
. # . # . . # # # .
|
||||
|
@ -6,7 +6,7 @@ Set the on/off state of pixel in an [Image](/reference/images/image).
|
||||
|
||||
### JavaScript
|
||||
|
||||
```
|
||||
```sig
|
||||
export function setPixel(_this: micro_bit.Image, x: number, y: number, value: boolean)
|
||||
```
|
||||
|
||||
@ -24,7 +24,7 @@ To figure out the ``x``, ``y`` coordinates, see [LED screen](/device/screen).
|
||||
|
||||
The following example creates an image and stores it in the `img` variable. The `set pixel` function sets the centre pixel off, before `img` is shown using `show image`.
|
||||
|
||||
```
|
||||
```blocks
|
||||
let img = images.createImage(`
|
||||
. . # . .
|
||||
. # . # .
|
||||
|
Loading…
Reference in New Issue
Block a user