Map and clean deprecated functions (#175)

* add image and deprecated arrow functions

* update locales

* map basic.showArrow

* map arrow blocks

* map & remove arrow images

* remove arrow blocks

* update locales

* remove & patch:
rgbw -> rgb
button/pin pressed -> button/pin event
loudness -> soundLevel

* update ts mappings for arrows

* add wip ts patch rules

* update .blocks files

* use Click instead of Down as default in Documentation and tests

* patch test.blocks

* fix lowercase name tag

* update test.blocks

* update blocks test files

* update blocks test files

* format block files

* pass blocks file tests

* fix ts mapping

* fix color.defl value

closes https://github.com/microsoft/pxt-calliope/issues/136

* fix ts mappings

- add optional spacing at the end of rgbw()
- map up to v4.0.19

* add suggested changes

* replace innerText by textContent

Co-authored-by: JW <gitkraken@juriwolf.de>
Co-authored-by: Juri <info@juriwolf.de>
This commit is contained in:
Juri Wolf
2022-04-26 19:28:42 +02:00
committed by GitHub
parent 3b9d90e551
commit a93febb5b7
102 changed files with 1458 additions and 740 deletions

View File

@ -16,11 +16,11 @@ 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, () => {
input.onButtonEvent(Button.B, ButtonEvent.Down, () => {
basic.showNumber(game.score())
game.setScore(0)
})
input.onButtonPressed(Button.A, () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
game.addScore(1)
})
```

View File

@ -16,7 +16,7 @@ Press button ``A`` as much as possible.
At the end of 10 seconds, the program will show your score.
```blocks
input.onButtonPressed(Button.A, () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
game.addScore(1)
})
game.startCountdown(10000)

View File

@ -27,7 +27,7 @@ let img = images.createImage(`
. . . . .
`)
img.showImage(0)
input.onButtonPressed(Button.A, () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
img.clear()
img.showImage(0)
})

View File

@ -14,10 +14,10 @@ If you press button `B`, it shows an animation and ends the game.
```blocks
basic.showString("PICK A BUTTON");
input.onButtonPressed(Button.A, () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
basic.showString("YOU WIN!");
});
input.onButtonPressed(Button.B, () => {
input.onButtonEvent(Button.B, ButtonEvent.Down, () => {
game.gameOver();
});
```

View File

@ -20,7 +20,7 @@ degrees -- exactly the opposite direction.
```blocks
let ball = game.createSprite(4, 2);
basic.showNumber(ball.get(LedSpriteProperty.Direction));
input.onButtonPressed(Button.B, () => {
input.onButtonEvent(Button.B, ButtonEvent.Down, () => {
ball.ifOnEdgeBounce();
basic.showNumber(ball.get(LedSpriteProperty.Direction));
});

View File

@ -15,7 +15,7 @@ game.isPaused()
Resume the game if it's paused and button **B** is pressed.
```blocks
input.onButtonPressed(Button.B, function () {
input.onButtonEvent(Button.B, ButtonEvent.Down, function () {
if (game.isPaused()) {
game.resume()
}

View File

@ -15,7 +15,7 @@ game.isRunning()
If the game is currently running, end the game if button **B** is pressed.
```blocks
input.onButtonPressed(Button.B, function () {
input.onButtonEvent(Button.B, ButtonEvent.Click, function () {
if (game.isRunning()) {
game.gameOver()
}

View File

@ -13,7 +13,7 @@ This program adds one point to your score every time you press button
second) and shows your score.
```blocks
input.onButtonPressed(Button.A, () => {
input.onButtonEvent(Button.A, ButtonEvent.Down, () => {
game.addScore(1);
basic.pause(500);
basic.showNumber(game.score());

View File

@ -16,11 +16,11 @@ 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, () => {
input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
basic.showNumber(game.score())
game.setScore(0)
})
input.onButtonPressed(Button.A, () => {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
game.addScore(1)
})
```

View File

@ -17,7 +17,7 @@ Press button ``A`` as much as possible.
At the end of 10 seconds, the program will show your score.
```blocks
input.onButtonPressed(Button.A, () => {
input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
game.addScore(1)
})
game.startCountdown(10000)