-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimer.js
More file actions
64 lines (63 loc) · 2.16 KB
/
timer.js
File metadata and controls
64 lines (63 loc) · 2.16 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
input.onButtonPressed(Button.A, function () {
basic.showLeds(`
. . # . .
. . # . .
# # # # #
. . # . .
. . # . .
`)
basic.pause(1000)
music.play(music.tonePlayable(494, music.beat(BeatFraction.Whole)), music.PlaybackMode.InBackground)
basic.showNumber(3)
basic.pause(200)
music.play(music.tonePlayable(494, music.beat(BeatFraction.Whole)), music.PlaybackMode.InBackground)
basic.showNumber(2)
basic.pause(200)
music.play(music.tonePlayable(494, music.beat(BeatFraction.Whole)), music.PlaybackMode.InBackground)
basic.showNumber(1)
basic.pause(200)
music.play(music.tonePlayable(988, music.beat(BeatFraction.Double)), music.PlaybackMode.UntilDone)
basic.showLeds(`
. . # . .
. . # . .
# # # # #
. . # . .
. . # . .
`)
drawSegment(0, 0)
music._playDefaultBackground(music.builtInPlayableMelody(Melodies.JumpUp), music.PlaybackMode.InBackground)
drawSegment(3, 0)
music._playDefaultBackground(music.builtInPlayableMelody(Melodies.JumpUp), music.PlaybackMode.InBackground)
drawSegment(0, 3)
music._playDefaultBackground(music.builtInPlayableMelody(Melodies.JumpUp), music.PlaybackMode.InBackground)
drawSegment(3, 3)
music._playDefaultBackground(music.builtInPlayableMelody(Melodies.PowerUp), music.PlaybackMode.InBackground)
basic.showIcon(IconNames.Happy)
basic.pause(1000)
basic.clearScreen()
})
function drawSegment (xStart: number, yStart: number) {
for (let index = 0; index <= 5; index++) {
led.toggle(xStart, yStart)
basic.pause(1000)
}
led.plot(xStart, yStart)
for (let index = 0; index <= 5; index++) {
led.toggle(xStart + 1, yStart)
basic.pause(1000)
}
led.plot(xStart + 1, yStart)
for (let index = 0; index <= 5; index++) {
led.toggle(xStart, yStart + 1)
basic.pause(1000)
}
led.plot(xStart, yStart + 1)
for (let index = 0; index <= 5; index++) {
led.toggle(xStart + 1, yStart + 1)
basic.pause(1000)
}
led.plot(xStart + 1, yStart + 1)
}
basic.showIcon(IconNames.Angry)
basic.forever(function () {
})