diff --git a/docs/SUMMARY.md b/docs/SUMMARY.md index a4dbe0ff..160f4f1b 100644 --- a/docs/SUMMARY.md +++ b/docs/SUMMARY.md @@ -181,6 +181,73 @@ * [set transmit power](/reference/radio/set-transmit-power) * [set transmit serial number](/reference/radio/set-transmit-serial-number) * [write received packet to serial](/reference/radio/write-received-packet-to-serial) + * [Game](/reference/game) + * [create sprite](/reference/game/create-sprite) + * [delete](/reference/game/delete) + * [move](/reference/game/move) + * [turn](/reference/game/turn) + * [in on edge bounce](/reference/game/if-on-edge-bounce) + * [get](/reference/game/get) + * [set](/reference/game/set) + * [change](/reference/game/change) + * [is touching](/reference/game/is-touching) + * [is touching edge](/reference/game/is-touching-edge) + * [add score](/reference/game/add-score) + * [score](/reference/game/score) + * [set score](/reference/game/set-score) + * [start countdown](/reference/game/start-countdown) + * [game over](/reference/game/game-over) + * [pause](/reference/game/pause) + * [resume](/reference/game/resume) + * [Images](/reference/images) + * [create image](/reference/images/create-image) + * [create big image](/reference/images/create-big-image) + * [show image](/reference/images/show-image) + * [scroll image](/reference/images/scroll-image) + * [arrow image](/reference/images/arrow-image) + * [icon image](/reference/images/icon-image) + * [arrow number](/reference/images/arrow-number) + * [Pins](/reference/pins) + * [digital read pin](/reference/pins/digital-read-pin) + * [digital write pin](/reference/pins/digital-write-pin) + * [analog read pin](/reference/pins/analog-read-pin) + * [analog write pin](/reference/pins/analog-write-pin) + * [analog set period](/reference/pins/analog-set-period) + * [map](/reference/pins/map) + * [on pulsed](/reference/pins/on-pulsed) + * [pulse duration](/reference/pins/pulse-duration) + * [pulse in](/reference/pins/pulse-in) + * [servo write pin](/reference/pins/servo-write-pin) + * [servo set pulse](/reference/pins/servo-set-pulse) + * [i2c read number](/reference/pins/i2c-read-number) + * [i2c write number](/reference/pins/i2c-write-number) + * [set pull](/reference/pins/set-pull) + * [analog pitch](/reference/pins/analog-pitch) + * [analog set pitch pin](/reference/pins/analog-set-pitch-pin) + * [spi write](/reference/pins/spi-write) + * [spi Pins](/reference/pins/spi-pins) + * [spi format](/reference/pins/spi-format) + * [spi frequency](/reference/pins/spi-frequency) + * [Serial](/reference/serial) + * [write line](/reference/serial/write-line) + * [write number](/reference/serial/write-number) + * [write value](/reference/serial/write-value) + * [write string](/reference/serial/write-string) + * [read until](/reference/serial/read-until) + * [read line](/reference/serial/read-line) + * [read string](/reference/serial/read-string) + * [on data received](/reference/serial/on-data-received) + * [redirect](/reference/serial/redirect-to) + * [write buffer](/reference/serial/write-buffer) + * [read buffer](/reference/serial/read-buffer) + * [Control](/reference/control) + * [in background](/reference/control/in-background) + * [reset](/reference/control/reset) + * [wait micros](/reference/control/wait-micros) + * [on event](/reference/control/on-event) + * [raise event](/reference/control/raise-event) + * [event timestamp](/reference/control/event-timestamp) + * [event value](/reference/control/event-value) * [Bluetooth](/reference/bluetooth) * [About](/reference/bluetooth/about-bluetooth) * [Pairing](/reference/bluetooth/bluetooth-pairing) diff --git a/docs/reference.md b/docs/reference.md index f5450e1b..ed058596 100644 --- a/docs/reference.md +++ b/docs/reference.md @@ -32,8 +32,8 @@ control.inBackground(() => { ## Bluetooth ```namespaces -devices.tellCameraTo(MesCameraEvent.TakePhoto); bluetooth.onBluetoothConnected(() => {}); +devices.tellCameraTo(MesCameraEvent.TakePhoto); ``` ```package diff --git a/docs/reference/game.md b/docs/reference/game.md index c1fc166d..9f632aad 100644 --- a/docs/reference/game.md +++ b/docs/reference/game.md @@ -36,9 +36,9 @@ game.resume(); ### See also -[createSprite](/reference/game/create-sprite), [move](/reference/game/move), [turn](/reference/game/turn), +[create sprite](/reference/game/create-sprite), [move](/reference/game/move), [turn](/reference/game/turn), [ifOnEdgeBounce](/reference/game/if-on-edge-bounce), [get](/reference/game/get), [set](/reference/game/set), -[change](/reference/game/change), [isTouching](/reference/game/touching) [isTouchingEdge](/reference/game/touching-edge), -[addScore](/reference/game/change-score-by), [score](/reference/game/score), [setScore](/reference/game/set-score), -[startCountdown](/reference/game/start-countdown), [gameOver](/reference/game/game-over), +[change](/reference/game/change), [is touching](/reference/game/is-touching) [is touching edge](/reference/game/is-touching-edge), +[add score](/reference/game/add-score), [score](/reference/game/score), [set score](/reference/game/set-score), +[start countdown](/reference/game/start-countdown), [game over](/reference/game/game-over), [pause](/reference/game/pause), [resume](/reference/game/resume) diff --git a/docs/reference/game/add-score.md b/docs/reference/game/add-score.md new file mode 100644 index 00000000..70b5e2f4 --- /dev/null +++ b/docs/reference/game/add-score.md @@ -0,0 +1,30 @@ +# add Score + +Add more to the current score for the game. + +```sig +game.addScore(1) +``` +### Parameters + +* a [number](/types/number) that means how much to add to the score. A negative number means to subtract from the score. + +### Examples + +This program is a simple game. +Press button ``A`` as much as possible to increase the score. +Press ``B`` to display the score and reset the score. + +```blocks +input.onButtonPressed(Button.B, () => { + basic.showNumber(game.score()) + game.setScore(0) +}) +input.onButtonPressed(Button.A, () => { + game.addScore(1) +}) +``` + +### See Also + +[score](/reference/game/score), [set score](/reference/game/set-score), [start countdown](/reference/game/start-countdown) diff --git a/docs/reference/game/change-score-by.md b/docs/reference/game/change-score-by.md deleted file mode 100644 index 0db9044c..00000000 --- a/docs/reference/game/change-score-by.md +++ /dev/null @@ -1,27 +0,0 @@ -# Change Score By - -Add the amount you say to the score for the game. - -```sig -game.addScore(1) -``` -### Parameters - -* a [number](/types/number) that means how much to add to the score. A negative number means to subtract from the score. - -### Examples - -This program is a simple game. -Press button ``A`` as much as possible. -At the end of 10 seconds, the program will show your score. - -```blocks -input.onButtonPressed(Button.A, () => { - game.addScore(1) -}) -game.startCountdown(10000) -``` - -### See Also - -[score](/reference/game/score), [start countdown](/reference/game/start-countdown) diff --git a/docs/reference/game/change.md b/docs/reference/game/change.md index 9a1c9ab3..446642ae 100644 --- a/docs/reference/game/change.md +++ b/docs/reference/game/change.md @@ -33,5 +33,5 @@ ball.change(LedSpriteProperty.X, 2); [turn](/reference/game/turn), [brightness](/reference/led/brightness), -[get sprite property](/reference/game/get-sprite-property), -[set sprite property](/reference/game/set-sprite-property) +[get sprite property](/reference/game/get), +[set sprite property](/reference/game/set) diff --git a/docs/reference/game/create-sprite.md b/docs/reference/game/create-sprite.md index ab166a9c..b11174ac 100644 --- a/docs/reference/game/create-sprite.md +++ b/docs/reference/game/create-sprite.md @@ -33,5 +33,5 @@ item.move(2); [move](/reference/game/move), [turn](/reference/game/turn), -[touching](/reference/game/touching) +[is-touching](/reference/game/is-touching) diff --git a/docs/reference/game/delete.md b/docs/reference/game/delete.md new file mode 100644 index 00000000..5d93d646 --- /dev/null +++ b/docs/reference/game/delete.md @@ -0,0 +1,26 @@ +# delete + +Delete a sprite from the game. + +```sig +let item: game.LedSprite = null; +item.delete(); +``` + +### Parameters + +* the **sprite** you want to delete from the game + +### Example + +This program makes a sprite and shows the number of its brightness on the screen. Then, it deletes the sprite. + +```blocks +let ball = game.createSprite(0, 2); +basic.showNumber(ball.get(LedSpriteProperty.Brightness)); +ball.delete(); +``` + +### See also + +[create sprite](/reference/game/create-sprite) diff --git a/docs/reference/game/game-over.md b/docs/reference/game/game-over.md index e39aba7f..e23f8278 100644 --- a/docs/reference/game/game-over.md +++ b/docs/reference/game/game-over.md @@ -25,4 +25,4 @@ input.onButtonPressed(Button.B, () => { ### See Also [score](/reference/game/score), -[change score by](/reference/game/change-score-by), [start countdown](/reference/game/start-countdown) +[add score](/reference/game/add-score), [start countdown](/reference/game/start-countdown) diff --git a/docs/reference/game/get.md b/docs/reference/game/get.md index d2eb870f..19d40ced 100644 --- a/docs/reference/game/get.md +++ b/docs/reference/game/get.md @@ -34,6 +34,6 @@ basic.showNumber(ball.get(LedSpriteProperty.Brightness)); [turn](/reference/game/turn), [brightness](/reference/led/brightness), -[change sprite property](/reference/game/change-sprite-property), -[set sprite property](/reference/game/set-sprite-property) +[change sprite property](/reference/game/change), +[set sprite property](/reference/game/set) diff --git a/docs/reference/game/if-on-edge-bounce.md b/docs/reference/game/if-on-edge-bounce.md index 7091679f..45af1dad 100644 --- a/docs/reference/game/if-on-edge-bounce.md +++ b/docs/reference/game/if-on-edge-bounce.md @@ -30,5 +30,5 @@ input.onButtonPressed(Button.B, () => { ### See also [create sprite](/reference/game/create-sprite), -[touching](/reference/game/touching), -[touching edge](/reference/game/touching-edge) +[is touching](/reference/game/is-touching), +[is touching edge](/reference/game/is-touching-edge) diff --git a/docs/reference/game/is-touching-edge.md b/docs/reference/game/is-touching-edge.md index ac08e98a..ecee081b 100644 --- a/docs/reference/game/is-touching-edge.md +++ b/docs/reference/game/is-touching-edge.md @@ -36,5 +36,5 @@ if (item.isTouchingEdge()) { ### See also [create sprite](/reference/game/create-sprite), -[touching](/reference/game/touching), +[is touching](/reference/game/is-touching), [if on edge, bounce](/reference/game/if-on-edge-bounce) diff --git a/docs/reference/game/is-touching.md b/docs/reference/game/is-touching.md index 3ed0a9d8..fa2a9c3b 100644 --- a/docs/reference/game/is-touching.md +++ b/docs/reference/game/is-touching.md @@ -37,5 +37,5 @@ if (matter.isTouching(antimatter)) { ### See also [create sprite](/reference/game/create-sprite), -[touching edge](/reference/game/touching-edge), +[is touching edge](/reference/game/is-touching-edge), [if on edge, bounce](/reference/game/if-on-edge-bounce) diff --git a/docs/reference/game/set-score.md b/docs/reference/game/set-score.md index 3be165f0..f2ee3fd4 100644 --- a/docs/reference/game/set-score.md +++ b/docs/reference/game/set-score.md @@ -27,4 +27,4 @@ input.onButtonPressed(Button.A, () => { ### See Also -[score](/reference/game/score), [start countdown](/reference/game/start-countdown) +[score](/reference/game/score), [add score](/reference/game/add-score), [start countdown](/reference/game/start-countdown) diff --git a/docs/reference/game/set.md b/docs/reference/game/set.md index 1a05e556..b39d8f4c 100644 --- a/docs/reference/game/set.md +++ b/docs/reference/game/set.md @@ -33,5 +33,5 @@ ball.set(LedSpriteProperty.X, 4); [turn](/reference/game/turn), [brightness](/reference/led/brightness), -[change sprite property](/reference/game/change-sprite-property), -[get sprite property](/reference/game/get-sprite-property) +[change sprite property](/reference/game/change), +[get sprite property](/reference/game/get) diff --git a/docs/reference/game/start-countdown.md b/docs/reference/game/start-countdown.md index 2dba0fe1..051c4865 100644 --- a/docs/reference/game/start-countdown.md +++ b/docs/reference/game/start-countdown.md @@ -25,5 +25,5 @@ game.startCountdown(10000) ### See Also -[score](/reference/game/score), [change score by](/reference/game/change-score-by) +[score](/reference/game/score), [add score](/reference/game/add-score)