update input blocks in docs and tests
This commit is contained in:
		@@ -7,7 +7,7 @@ let level: number
 | 
			
		||||
let swapSpeed: number
 | 
			
		||||
 | 
			
		||||
initializeGame()
 | 
			
		||||
input.onButtonPressed(Button.A, () => {
 | 
			
		||||
input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
 | 
			
		||||
    if (ballRevealing) {
 | 
			
		||||
        index = index + 1
 | 
			
		||||
        if (index > 2) {
 | 
			
		||||
@@ -16,7 +16,7 @@ input.onButtonPressed(Button.A, () => {
 | 
			
		||||
        basic.showString(cupSelect[index], 150)
 | 
			
		||||
    }
 | 
			
		||||
})
 | 
			
		||||
input.onButtonPressed(Button.B, () => {
 | 
			
		||||
input.input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_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.onButtonPressed(Button.A, () => {
 | 
			
		||||
input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
 | 
			
		||||
    if (oneX > 0) {
 | 
			
		||||
        led.unplot(oneX, oneY)
 | 
			
		||||
        led.unplot(twoX, twoY)
 | 
			
		||||
@@ -28,7 +28,7 @@ input.onButtonPressed(Button.A, () => {
 | 
			
		||||
        led.plot(twoX, twoY)
 | 
			
		||||
    }
 | 
			
		||||
})
 | 
			
		||||
input.onButtonPressed(Button.B, () => {
 | 
			
		||||
input.input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
 | 
			
		||||
    if (twoX < 4) {
 | 
			
		||||
        led.unplot(oneX, oneY)
 | 
			
		||||
        led.unplot(twoX, twoY)
 | 
			
		||||
 
 | 
			
		||||
@@ -107,12 +107,12 @@ basic.forever(() => {
 | 
			
		||||
        basic.pause(500)
 | 
			
		||||
    }
 | 
			
		||||
})
 | 
			
		||||
input.onButtonPressed(Button.A, () => {
 | 
			
		||||
input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
 | 
			
		||||
    let temp = Math.abs(person.dirX) * (-1)
 | 
			
		||||
    person.dirX = Math.abs(person.dirY) * (-1)
 | 
			
		||||
    person.dirY = temp
 | 
			
		||||
})
 | 
			
		||||
input.onButtonPressed(Button.B, () => {
 | 
			
		||||
input.input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_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.onButtonPressed(Button.A, () => {
 | 
			
		||||
    input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
 | 
			
		||||
        AWasPressed = true
 | 
			
		||||
    })
 | 
			
		||||
    input.onButtonPressed(Button.B, () => {
 | 
			
		||||
    input.input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
 | 
			
		||||
        BWasPressed = true
 | 
			
		||||
    })
 | 
			
		||||
    input.onButtonPressed(Button.AB, () => {
 | 
			
		||||
    input.input.onButtonEvent(Button.AB, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
 | 
			
		||||
        ABWasPressed = true
 | 
			
		||||
        AWasPressed = false
 | 
			
		||||
        BWasPressed = false
 | 
			
		||||
 
 | 
			
		||||
@@ -501,13 +501,13 @@ function convertPenaltyTimeToScore(penaltyTime: number): number {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function startIOMonitor() {
 | 
			
		||||
    input.onButtonPressed(Button.A, () => {
 | 
			
		||||
    input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
 | 
			
		||||
        AWasPressed = true
 | 
			
		||||
    })
 | 
			
		||||
    input.onButtonPressed(Button.B, () => {
 | 
			
		||||
    input.input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
 | 
			
		||||
        BWasPressed = true
 | 
			
		||||
    })
 | 
			
		||||
    input.onButtonPressed(Button.AB, () => {
 | 
			
		||||
    input.input.onButtonEvent(Button.AB, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
 | 
			
		||||
        ABWasPressed = true
 | 
			
		||||
    })
 | 
			
		||||
    input.onShake(() => {
 | 
			
		||||
 
 | 
			
		||||
@@ -377,11 +377,11 @@ function beepNTimesFor(times: number, duration: number) {
 | 
			
		||||
 | 
			
		||||
function startIOMonitor() {
 | 
			
		||||
    aWasPressed = false
 | 
			
		||||
    input.onButtonPressed(Button.A, () => {
 | 
			
		||||
    input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
 | 
			
		||||
        aWasPressed = true
 | 
			
		||||
    })
 | 
			
		||||
    bWasPressed = false
 | 
			
		||||
    input.onButtonPressed(Button.B, () => {
 | 
			
		||||
    input.input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
 | 
			
		||||
        bWasPressed = true
 | 
			
		||||
    })
 | 
			
		||||
    wasTweezers = false
 | 
			
		||||
 
 | 
			
		||||
@@ -476,10 +476,10 @@ function testTiltZ() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function startIOMonitor() {
 | 
			
		||||
    input.onButtonPressed(Button.A, () => {
 | 
			
		||||
    input.input.onButtonEvent(Button.A, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
 | 
			
		||||
        AWasPressed = true
 | 
			
		||||
    })
 | 
			
		||||
    input.onButtonPressed(Button.B, () => {
 | 
			
		||||
    input.input.onButtonEvent(Button.B, DAL.MICROBIT_BUTTON_EVT_CLICK, () => {
 | 
			
		||||
        BWasPressed = true
 | 
			
		||||
    })
 | 
			
		||||
    input.onShake(() => {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user