-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.ts
65 lines (65 loc) · 1.47 KB
/
main.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
function neustart () {
Wert = 0
keyTest = []
sprite = game.createSprite(0, 0)
sprite.set(LedSpriteProperty.Blink, 200)
}
// alternative, weil anfangs key == keyTest -> false ??
function testKeyTest () {
for (let Index = 0; Index <= 4; Index++) {
if (key[Index] == keyTest[Index]) {
Wert += 1
}
}
if (Wert == 5) {
basic.showIcon(IconNames.Yes)
} else {
basic.showIcon(IconNames.No)
}
}
input.onButtonPressed(Button.A, function () {
if (sprite.get(LedSpriteProperty.Y) == 4) {
sprite.set(LedSpriteProperty.Y, 0)
} else {
sprite.change(LedSpriteProperty.Y, 1)
}
})
input.onButtonPressed(Button.AB, function () {
sprite.delete()
neustart()
})
input.onButtonPressed(Button.B, function () {
keyTest.push(sprite.get(LedSpriteProperty.Y))
game.pause()
if (sprite.get(LedSpriteProperty.X) == 4) {
basic.pause(2000)
game.resume()
sprite.delete()
testKeyTest()
neustart()
} else {
basic.pause(500)
game.resume()
sprite.set(LedSpriteProperty.Y, 0)
sprite.change(LedSpriteProperty.X, 1)
}
})
let sprite: game.LedSprite = null
let keyTest: number[] = []
let Wert = 0
let key: number[] = []
key = [
0,
1,
2,
3,
4
]
neustart()
basic.forever(function () {
if (game.isPaused()) {
for (let Index = 0; Index <= keyTest.length - 1; Index++) {
led.plot(Index, keyTest[Index])
}
}
})