batch replace onButtonPressed(Button...

This commit is contained in:
Peli de Halleux
2016-03-29 21:17:57 -07:00
parent 1f7e0b0f79
commit 850c313c5d
68 changed files with 187 additions and 187 deletions

View File

@ -10,14 +10,14 @@ This [guided tutorial](/microbit/lessons/typing-game/tutorial) will teach you ho
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
index = 0
name = ""
input.onButtonPressed("A", () => {
input.onButtonPressed(Button.A, () => {
led.showString(alphabet.substr(index, 1), 0)
index = index + 1
})
if (index > 25) {
index = 0
}
input.onButtonPressed("B", () => {
input.onButtonPressed(Button.B, () => {
name = name.concat(alphabet.substr(index - 1, 1))
})
input.onGesture(Gesture.Shake, () => {
@ -33,14 +33,14 @@ After you have shown the string in the condition `on shake`, make the name varia
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
index = 0
name = ""
input.onButtonPressed("A", () => {
input.onButtonPressed(Button.A, () => {
led.showString(alphabet.substr(index, 1), 0)
index = index + 1
})
if (index > 25) {
index = 0
}
input.onButtonPressed("B", () => {
input.onButtonPressed(Button.B, () => {
name = name.concat(alphabet.substr(index - 1, 1))
})
input.onGesture(Gesture.Shake, () => {
@ -57,14 +57,14 @@ After you have cleared the name variable to hold nothing, make `index := 0` so t
alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
index = 0
name = ""
input.onButtonPressed("A", () => {
input.onButtonPressed(Button.A, () => {
led.showString(alphabet.substr(index, 1), 0)
index = index + 1
})
if (index > 25) {
index = 0
}
input.onButtonPressed("B", () => {
input.onButtonPressed(Button.B, () => {
name = name.concat(alphabet.substr(index - 1, 1))
})
input.onGesture(Gesture.Shake, () => {