-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ts
More file actions
97 lines (97 loc) · 7.61 KB
/
Copy pathmain.ts
File metadata and controls
97 lines (97 loc) · 7.61 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
controller.B.onEvent(ControllerButtonEvent.Pressed, function () {
if (dino.isHittingTile(CollisionDirection.Bottom)) {
dino.vy = -200
}
})
controller.A.onEvent(ControllerButtonEvent.Pressed, function () {
projectile = sprites.createProjectileFromSprite(img`
. . 6 6 6 6 . .
. 6 d 4 4 4 6 .
6 1 b 1 1 4 d 6
c 1 b b 4 4 1 c
. c b b b d c .
. . c c c c . .
`, dino, pewSpeed, 0)
})
controller.left.onEvent(ControllerButtonEvent.Pressed, function () {
dinoSpeed = 35
dino.vx = dinoSpeed
})
controller.right.onEvent(ControllerButtonEvent.Pressed, function () {
dinoSpeed = 70
dino.vx = dinoSpeed
})
let myEnemy: Sprite = null
let playerYPos = 0
let playerXPos = 0
let pewSpeed = 0
let projectile: Sprite = null
let dinoSpeed = 0
let dino: Sprite = null
scene.setBackgroundColor(5)
tiles.setTilemap(tiles.createTilemap(hex`c800080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001010000000000000b0b01010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010202020100000000000000000000000000000000000001010101010000000000000000000000000000000000000000000101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000101020200000000000b010202020101010000000000000000000000000000000000000000000000000000000000010101000000000000000000000000000000000000000000000001020202020200000000000000000000000000000101010102020202000000000000000000010101000000000000000000000202020101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000001010100000000000000010202020201010001010102020202020202010100000000000000000000000000000000000000000000000000000a0202020101010000000000000000000000000001010101000000020202020202000001010100000101010101010102020202020202020201000000000000000202020100000000000000000102020202020000000000000000000000000000000000000000000000000008000000000000000000000000000000000001010101010101010100000000030000040001020202010100000b000002020202020202010202020202020202020202020101010000090009000000000a0a00000000000000000b00000b010202020202020000000000000000000001010102020202010001020202020202010102020201010202020202020202020202020202020202010000000000010202020201000000000000010202020202020000000000000000000000000000000000000000000607060605070606070000000001010101010101010102020202020202020202010101010101010101020202020201010101010202020202020202020202020202020202020202020202010101010101010101010101010101010101010101010102020202020202010101010101010101010102020202020202010202020202020202020202020202020202020202020202020202020202020202010101010102020202020200000101010102020202020202010101010101010101010101010101010101010101010101010101010101010101010202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020101020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202`, img`
........................................................................................................................................................................................................
.................................................................................................................222....................................................................................
.........................................22........22...........................................................22222..................22222.....................222....................................
.......................................2222......2222222.............................222.......................222222..............22222222.........222..........22222..................................
............................222.......2222222.222222222222...........................222222.............2222...222222..222..22222222222222222.......2222........222222..................................
.........222222222.........222222.....22222222222222222222222.......................2222222..........22222222.22222222222222222222222222222222.....222222......2222222..................................
222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222..222222222222222222222222222222222222222222222
22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222
`, [myTiles.transparency16,sprites.castle.tilePath2,sprites.castle.tilePath5,sprites.castle.saplingPine,sprites.castle.shrub,sprites.dungeon.stairSouth,sprites.dungeon.floorDark5,sprites.dungeon.floorDark2,sprites.dungeon.collectibleBlueCrystal,sprites.castle.rock1,sprites.castle.rock2,sprites.castle.rock0], TileScale.Sixteen))
dino = sprites.create(img`
. . . . . . . . . . . . .
. . . f f f f f f . . . .
. f f f f f f f f f . . .
. f f f f f f c f f f . .
f f f f c f f f c f f f .
f c f f c c f f f c c f f
f c c f f f f e f f f f f
f f f f f f f e e f f f .
f f e e f b f e e f f f .
f f e 4 e 1 f 4 4 f f . .
. f f f e 4 4 4 4 f . . .
. 4 4 4 e e e e f f . . .
. e 4 4 e 7 7 7 7 f . . .
. f e e f 6 6 6 6 f f . .
. f f f f f f f f f f . .
. . f f . . . f f f . . .
`, SpriteKind.Player)
dinoSpeed = 40
dino.ay = 500
scene.cameraFollowSprite(dino)
let enemyGravity = 500
game.onUpdate(function () {
pewSpeed = dinoSpeed + 100
playerXPos = dino.x + 150
playerYPos = dino.y + -5
myEnemy.follow(dino)
})
game.onUpdateInterval(5000, function () {
myEnemy = sprites.createProjectileFromSide(img`
........................
........................
........................
........................
..........fffff.........
........ff1111bff.......
.......fb1111111bf......
.......f111111111f......
......fd1111111ffff.....
......fd111dd1c111bf....
......fb11fcdf1b1bff....
......f11111bfbfbff.....
......f1b1bdfcffff......
......fbfbfcfcccf.......
......ffffffffff........
.........ffffff.........
.........ffffff.........
.........fffffff..f.....
..........fffffffff.....
...........fffffff......
........................
........................
........................
........................
`, -26, 0)
})