-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ts
More file actions
47 lines (47 loc) · 1.52 KB
/
main.ts
File metadata and controls
47 lines (47 loc) · 1.52 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
namespace SpriteKind {
export const Feld = SpriteKind.create()
}
// Debug-Ausgabe
sprites.onOverlap(SpriteKind.Enemy, SpriteKind.Player, function (sprite, otherSprite) {
info.changeLifeBy(-1)
sprites.destroy(sprite)
})
let highscore = 0
let Hinderniss_oben: Sprite = null
let Hinderniss_unten: Sprite = null
effects.confetti.startScreenEffect(200)
scene.setBackgroundImage(assets.image`Hintergrund`)
let Abstand = 80
let Gustav_Gans = sprites.create(assets.image`Duck`, SpriteKind.Player)
controller.moveSprite(Gustav_Gans, 0, 100)
scroller.scrollBackgroundWithSpeed(-50, 0)
Gustav_Gans.setStayInScreen(true)
info.setLife(3)
info.setScore(0)
animation.runImageAnimation(
Gustav_Gans,
assets.animation`Duck_animation`,
100,
true
)
game.onUpdateInterval(2500, function () {
Hinderniss_unten = sprites.create(assets.image`Hinderniss_unten`, SpriteKind.Enemy)
Hinderniss_oben = sprites.create(assets.image`Hinderniss_unten`, SpriteKind.Enemy)
Hinderniss_unten.setScale(2, ScaleAnchor.Middle)
Hinderniss_oben.setScale(2, ScaleAnchor.Middle)
Hinderniss_unten.setPosition(scene.screenWidth(), randint(80, 150))
Hinderniss_oben.setPosition(scene.screenWidth(), randint(-30, 40) - Abstand)
Hinderniss_unten.vx = -50
Hinderniss_oben.vx = -50
info.changeScoreBy(1)
})
forever(function () {
pause(10)
Gustav_Gans.y += 0.6
while (info.life() == 0) {
while (info.score() > info.highScore()) {
highscore = info.score()
game.splash("Highscore:", highscore)
}
}
})