Hide DAL.x behind Enum
This commit is contained in:
@ -7,7 +7,7 @@ let level: number
|
||||
let swapSpeed: number
|
||||
|
||||
initializeGame()
|
||||
input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
if (ballRevealing) {
|
||||
index = index + 1
|
||||
if (index > 2) {
|
||||
@ -16,7 +16,7 @@ input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
basic.showString(cupSelect[index], 150)
|
||||
}
|
||||
})
|
||||
input.input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
if (ballRevealing) {
|
||||
ballRevealing = false
|
||||
if (correctBall == index) {
|
||||
|
@ -18,7 +18,7 @@ counter = 0
|
||||
pause = 700
|
||||
led.plot(oneX, oneY)
|
||||
led.plot(twoX, twoY)
|
||||
input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
if (oneX > 0) {
|
||||
led.unplot(oneX, oneY)
|
||||
led.unplot(twoX, twoY)
|
||||
@ -28,7 +28,7 @@ input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
led.plot(twoX, twoY)
|
||||
}
|
||||
})
|
||||
input.input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
if (twoX < 4) {
|
||||
led.unplot(oneX, oneY)
|
||||
led.unplot(twoX, twoY)
|
||||
|
@ -107,12 +107,12 @@ basic.forever(() => {
|
||||
basic.pause(500)
|
||||
}
|
||||
})
|
||||
input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
let temp = Math.abs(person.dirX) * (-1)
|
||||
person.dirX = Math.abs(person.dirY) * (-1)
|
||||
person.dirY = temp
|
||||
})
|
||||
input.input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
let temp1 = Math.abs(person.dirX)
|
||||
person.dirX = Math.abs(person.dirY)
|
||||
person.dirY = temp1
|
||||
|
@ -24,13 +24,13 @@ playOneGame(gameTime)
|
||||
showFinalScores(scoreA, scoreB)
|
||||
|
||||
function startIOMonitor() {
|
||||
input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
AWasPressed = true
|
||||
})
|
||||
input.input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
BWasPressed = true
|
||||
})
|
||||
input.input.onButtonEvent(Button.AB, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.AB, ButtonEvent.Click, () => {
|
||||
ABWasPressed = true
|
||||
AWasPressed = false
|
||||
BWasPressed = false
|
||||
|
@ -501,13 +501,13 @@ function convertPenaltyTimeToScore(penaltyTime: number): number {
|
||||
}
|
||||
|
||||
function startIOMonitor() {
|
||||
input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
AWasPressed = true
|
||||
})
|
||||
input.input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
BWasPressed = true
|
||||
})
|
||||
input.input.onButtonEvent(Button.AB, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.AB, ButtonEvent.Click, () => {
|
||||
ABWasPressed = true
|
||||
})
|
||||
input.onShake(() => {
|
||||
|
@ -377,11 +377,11 @@ function beepNTimesFor(times: number, duration: number) {
|
||||
|
||||
function startIOMonitor() {
|
||||
aWasPressed = false
|
||||
input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
aWasPressed = true
|
||||
})
|
||||
bWasPressed = false
|
||||
input.input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
bWasPressed = true
|
||||
})
|
||||
wasTweezers = false
|
||||
|
@ -476,10 +476,10 @@ function testTiltZ() {
|
||||
}
|
||||
|
||||
function startIOMonitor() {
|
||||
input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.A, ButtonEvent.Click, () => {
|
||||
AWasPressed = true
|
||||
})
|
||||
input.input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
|
||||
input.input.onButtonEvent(Button.B, ButtonEvent.Click, () => {
|
||||
BWasPressed = true
|
||||
})
|
||||
input.onShake(() => {
|
||||
|
Reference in New Issue
Block a user