-
Notifications
You must be signed in to change notification settings - Fork 1
/
custom.ts
40 lines (35 loc) · 987 Bytes
/
custom.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* Use this file to define custom functions and blocks.
* Read more at https://makecode.microbit.org/blocks/custom
*/
enum MyEnum {
//% block="one"
One,
//% block="two"
Two
}
/**
* Custom blocks
*/
//% weight=100 color=#0fbc11 icon=""
namespace custom {
/**
* TODO: describe your function here
* @param checkDoor is the pin the user clicked, eg: 0
*/
//% block
export function checkDoor(doorNum: number): void {
if (doorNum == 1) {
basic.showIcon(IconNames.Yes)
for (let index = 0; index < 3; index++) {
music.startMelody(music.builtInMelody(Melodies.BaDing), MelodyOptions.OnceInBackground)
basic.pause(500)
}
basic.showString("You found it!")
} else {
basic.showIcon(IconNames.No)
music.startMelody(music.builtInMelody(Melodies.Wawawawaa), MelodyOptions.Once)
game.gameOver()
}
}
}