Hide DAL.x behind Enum
This commit is contained in:
@ -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.input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
basic.showNumber(game.score())
|
||||
game.setScore(0)
|
||||
})
|
||||
input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
game.addScore(1)
|
||||
})
|
||||
```
|
||||
|
@ -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.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
game.addScore(1)
|
||||
})
|
||||
game.startCountdown(10000)
|
||||
|
@ -27,7 +27,7 @@ let img = images.createImage(`
|
||||
. . . . .
|
||||
`)
|
||||
img.showImage(0)
|
||||
input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
img.clear()
|
||||
img.showImage(0)
|
||||
})
|
||||
|
@ -14,10 +14,10 @@ If you press button `B`, it shows an animation and ends the game.
|
||||
|
||||
```blocks
|
||||
basic.showString("PICK A BUTTON");
|
||||
input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
basic.showString("YOU WIN!");
|
||||
});
|
||||
input.input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
game.gameOver();
|
||||
});
|
||||
```
|
||||
|
@ -20,7 +20,7 @@ degrees -- exactly the opposite direction.
|
||||
```blocks
|
||||
let ball = game.createSprite(4, 2);
|
||||
basic.showNumber(ball.get(LedSpriteProperty.Direction));
|
||||
input.input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
ball.ifOnEdgeBounce();
|
||||
basic.showNumber(ball.get(LedSpriteProperty.Direction));
|
||||
});
|
||||
|
@ -13,7 +13,7 @@ This program adds one point to your score every time you press button
|
||||
second) and shows your score.
|
||||
|
||||
```blocks
|
||||
input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
game.addScore(1);
|
||||
basic.pause(500);
|
||||
basic.showNumber(game.score());
|
||||
|
@ -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.input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
basic.showNumber(game.score())
|
||||
game.setScore(0)
|
||||
})
|
||||
input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
game.addScore(1)
|
||||
})
|
||||
```
|
||||
|
@ -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.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
game.addScore(1)
|
||||
})
|
||||
game.startCountdown(10000)
|
||||
|
Reference in New Issue
Block a user