generated from eduardomhd/csta-2021
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.ts
50 lines (50 loc) · 1.8 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
sprites.onOverlap(SpriteKind.Player, SpriteKind.Projectile, function (sprite, otherSprite) {
info.changeScoreBy(1)
otherSprite.destroy(effects.hearts, 100)
music.baDing.play()
})
let projectile: Sprite = null
scene.setBackgroundColor(5)
let mySprite = sprites.create(img`
. . . . c c c c c c . . . . . .
. . . c 6 7 7 7 7 6 c . . . . .
. . c 7 7 7 7 7 7 7 7 c . . . .
. c 6 7 7 7 7 7 7 7 7 6 c . . .
. c 7 c 6 6 6 6 c 7 7 7 c . . .
. f 7 6 f 6 6 f 6 7 7 7 f . . .
. f 7 7 7 7 7 7 7 7 7 7 f . . .
. . f 7 7 7 7 6 c 7 7 6 f c . .
. . . f c c c c 7 7 6 f 7 7 c .
. . c 7 2 7 7 7 6 c f 7 7 7 7 c
. c 7 7 2 7 7 c f c 6 7 7 6 c c
c 1 1 1 1 7 6 f c c 6 6 6 c . .
f 1 1 1 1 1 6 6 c 6 6 6 6 f . .
f 6 1 1 1 1 1 6 6 6 6 6 c f . .
. f 6 1 1 1 1 1 1 6 6 6 f . . .
. . c c c c c c c c c f . . . .
`, SpriteKind.Player)
controller.moveSprite(mySprite)
mySprite.setStayInScreen(true)
info.setScore(0)
info.startCountdown(10)
game.onUpdateInterval(500, function () {
projectile = sprites.createProjectileFromSide(img`
. . . . . . . e c 7 . . . . . .
. . . . e e e c 7 7 e e . . . .
. . c e e e e c 7 e 2 2 e e . .
. c e e e e e c 6 e e 2 2 2 e .
. c e e e 2 e c c 2 4 5 4 2 e .
c e e e 2 2 2 2 2 2 4 5 5 2 2 e
c e e 2 2 2 2 2 2 2 2 4 4 2 2 e
c e e 2 2 2 2 2 2 2 2 2 2 2 2 e
c e e 2 2 2 2 2 2 2 2 2 2 2 2 e
c e e 2 2 2 2 2 2 2 2 2 2 2 2 e
c e e 2 2 2 2 2 2 2 2 2 2 4 2 e
. e e e 2 2 2 2 2 2 2 2 2 4 e .
. 2 e e 2 2 2 2 2 2 2 2 4 2 e .
. . 2 e e 2 2 2 2 2 4 4 2 e . .
. . . 2 2 e e 4 4 4 2 e e . . .
. . . . . 2 2 e e e e . . . . .
`, 50, 0)
projectile.setPosition(0, randint(0, scene.screenHeight()))
})