batch replace onButtonPressed(Button...
This commit is contained in:
1 parent
1f7e0b0f79
commit
850c313c5d
68 files changed
+187
-187
No files matched your search
@@ -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