batch replace onButtonPressed(Button...
This commit is contained in:
@@ -26,10 +26,10 @@ ball.setDirection(-45)
|
||||
The user will control the paddle by pressing ``A`` to go up and ``B`` to go down. Let's add ``on button pressed`` event handlers to do that.
|
||||
|
||||
```
|
||||
input.onButtonPressed("A", () => {
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
paddle.changeYBy(-1)
|
||||
})
|
||||
input.onButtonPressed("B", () => {
|
||||
input.onButtonPressed(Button.B, () => {
|
||||
paddle.changeYBy(1)
|
||||
})
|
||||
```
|
||||
|
@@ -42,7 +42,7 @@ led.plot(ballX, ballY)
|
||||
<br/>
|
||||
|
||||
```
|
||||
input.onButtonPressed("A", () => {
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
if (paddleNotUp()) {
|
||||
led.unplot(0, paddleY)
|
||||
paddleY = paddleY - 1
|
||||
@@ -56,7 +56,7 @@ input.onButtonPressed("A", () => {
|
||||
<br/>
|
||||
|
||||
```
|
||||
input.onButtonPressed("A", () => {
|
||||
input.onButtonPressed(Button.A, () => {
|
||||
if (paddleNotDown()) {
|
||||
led.unplot(0, paddleY)
|
||||
paddleY = paddleY + 1
|
||||
|
Reference in New Issue
Block a user