324 lines
26 KiB
TypeScript
324 lines
26 KiB
TypeScript
controller.up.onEvent(ControllerButtonEvent.Pressed, function () {
|
|
py = 1
|
|
})
|
|
controller.B.onEvent(ControllerButtonEvent.Pressed, function () {
|
|
music.pewPew.play()
|
|
projectile = sprites.createProjectileFromSprite(img`
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . . . 2 2 . . . . . . .
|
|
. . . . . . 3 1 1 3 . . . . . .
|
|
. . . . . 2 1 1 1 1 2 . . . . .
|
|
. . . . . 2 1 1 1 1 2 . . . . .
|
|
. . . . . . 3 1 1 3 . . . . . .
|
|
. . . . . . . 2 2 . . . . . . .
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . . . . . . . . . . . .
|
|
`, mySprite, px * 200, py * -200)
|
|
})
|
|
controller.A.onEvent(ControllerButtonEvent.Pressed, function () {
|
|
if (mySprite.vy == 0) {
|
|
music.footstep.play()
|
|
mySprite.vy = -150
|
|
}
|
|
})
|
|
controller.down.onEvent(ControllerButtonEvent.Released, function () {
|
|
py = 0
|
|
})
|
|
scene.onOverlapTile(SpriteKind.Player, sprites.dungeon.doorClosedNorth, function (sprite, location) {
|
|
if (canTP) {
|
|
music.knock.play()
|
|
tiles.placeOnRandomTile(mySprite, sprites.dungeon.doorOpenNorth)
|
|
canTP = 0
|
|
}
|
|
})
|
|
controller.up.onEvent(ControllerButtonEvent.Released, function () {
|
|
py = 0
|
|
})
|
|
controller.down.onEvent(ControllerButtonEvent.Pressed, function () {
|
|
py = -1
|
|
})
|
|
controller.menu.onEvent(ControllerButtonEvent.Pressed, function () {
|
|
if (_type) {
|
|
typeSprite.setImage(assets.image`red`)
|
|
_type = 0
|
|
} else {
|
|
typeSprite.setImage(assets.image`blue`)
|
|
_type = 1
|
|
}
|
|
})
|
|
scene.onOverlapTile(SpriteKind.Player, sprites.swamp.swampTile7, function (sprite, location) {
|
|
game.over(false)
|
|
})
|
|
scene.onHitWall(SpriteKind.Projectile, function (sprite, location) {
|
|
for (let value of tiles.getTilesByType(sprites.dungeon.doorClosedNorth)) {
|
|
tiles.setTileAt(value, sprites.castle.tilePath5)
|
|
tiles.setWallAt(value, true)
|
|
}
|
|
tiles.setTileAt(location, sprites.dungeon.doorClosedNorth)
|
|
tiles.setWallAt(location, false)
|
|
})
|
|
scene.onOverlapTile(SpriteKind.Player, sprites.swamp.swampTile9, function (sprite, location) {
|
|
game.over(false)
|
|
})
|
|
scene.onOverlapTile(SpriteKind.Player, sprites.dungeon.collectibleRedCrystal, function (sprite, location) {
|
|
level += 1
|
|
if (level == levels.length) {
|
|
game.over(true)
|
|
} else {
|
|
music.baDing.play()
|
|
startLevel()
|
|
}
|
|
})
|
|
function startLevel () {
|
|
scene.setBackgroundImage(img`
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999999d99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
999999999999999999999999999dd999999d9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
999999999999999999999999999ddd99999d999999999999d999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
99999999999999999999999999ddddd9999dd9999999999ddd99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999ddddddd999dd9999999999ddd99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999d9dddd999ddd999999999ddddd9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
99999999999999999999999999ddddd999dddd99999999dddddd999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999ddddddd999dd9999999999dddd9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
99999999999999999999999999dddd9dd99ddd9999999dddddd9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999dddddd999ddd999999999dddddd999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
999999999999999999999999dd9ddddd99dddd9999999ddddd9dd99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
99999999999999999999999999dddddddddddd999999ddddddd9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999999999999999ddddddddddddddddddd99dddddd999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
|
|
9999999999999d9999999999ddddddddddddddddddddd99dddddd9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999d999999999999999999
|
|
999999999999ddd99999999999ddddddddddddddddddddddd99999999999999999999999999999999999999999999999999999999999999999999999999999999999999d9999dd999999999999999999
|
|
999999999999dd9999999999dddddddddddddddddddddddddd9999999999999999999999999999999999d99999999999999999999999999999999999999999999999999dd999dd999999999999999999
|
|
99999999999ddd999999999dddddddddddddddddddddddddddd999999999999999999999999999999999dd9999999999999999999999999999999999999999999999999dd99ddd999999999999999999
|
|
9999999999ddddd999999ddddddddddddddddddddddddddddddd99999999999999999999999999999999dd99999999999999999999999999999999999999999999d999dddd9ddddd9999999999999999
|
|
99999999999ddd99999dddddddddddddddddddddddddddddddddd999999999999999999999999999999dddd999999999999999999999999999999999999999999ddd99dddd99dd999999999999999999
|
|
999999999999ddd999dddddddddddddddddddddddddddddddddddd99999999999999999999999999999dddd9999d9999999999999999999999999999999999999ddd999dd99dddddd999999999999999
|
|
9999999999dddd99ddddddddddddddddddddddddddddddddddddddd999999999999999999999dd999999dd99999d999999999999999999999999999999999999dddd9ddddddddd999999999d99999999
|
|
99999999999ddddddddddddddddddddddddddddddddddddddddddddd9999999999999999999ddd9999dddddd999dd9999999999999999999999999999999999999ddd9dddd999dd99999999d99999999
|
|
999999999999ddddddddddddddddddddddddddddddddddddddddddddd99999999999999999dddd99999dddd9999dd999999999999999999999999999999999999ddd99ddddd99d99999999dddd999999
|
|
999999999999dddddddddddddddddddddddddddddddddddddddddddddd999999999999999999ddd9999ddddd99ddd9999999999999d99999999999999999999ddddddddddddd9d999999999d99999999
|
|
99999999999ddddddddddddddddddddddddddddddddddddddddddddddd9999999999999999dddddd9dddddddd9dddd99999999999dd999999999999999999999ddddddddddddddddd9999dddd9999999
|
|
9999999999ddddddddddddddddddddddddddddddddddddddddddddddddd99999999999999dddddd9dddddddddd9dd999999999999ddd9999999999999d99999ddddd99ddddddddddddd999ddd9999999
|
|
99999999dddddddddddddddddddddddddddddddddddddddddddddddddddd999999999999999dddddd99dddd9999ddd9999999999ddddd999999999999d9999dddddddddddddddddddddd99ddddd99999
|
|
9999999dddddddddddddddddddddddddddddddddddddddddddddddddddddd9999999999999dddddd99dddddd99ddd9999999999ddddddd99999999999dd99999dddddddddddddddddddddddddd999999
|
|
999999dddddddddddddddddddddddddddddddddddddddddddddddddddddddd99999999999ddddddddddddddddddddddd9999999d9dddd999999999999dd9999dddddddddddddddddddddddddd9999999
|
|
99999dddddddddddddddddddddddddddddddddddddddddddddddddddddddddd9999999999999ddddddddddddddddddddddd99999ddddd99999999999ddd9999dddddddddddddddddddddddddd9999999
|
|
999ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd99999999999dddddddddddddddddddddddddd99ddddddd99999999999d9999dddddddddddddddddddddddddddd999999
|
|
99ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd99999999dddddddddddddddddddddddddddddd9dddd9d9999999999dddd99dddddddddddddddddddddddddddddd9999
|
|
9dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd99999ddddddddddddddddddddddddddddddddddddd999999999999dd99ddddddddddddddddddddddddddddddddd99
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd999ddddddddddddddddddddddddddddddddddddddd999999999ddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd9999999999dddddddddddddddddddddddddddddddddddddddd
|
|
ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd9999999999ddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd9999999ddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd9999dddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd
|
|
`)
|
|
tiles.setCurrentTilemap(levels[level])
|
|
mySprite.setPosition(75, 40)
|
|
game.showLongText(levelStartMessage[level], DialogLayout.Bottom)
|
|
}
|
|
scene.onOverlapTile(SpriteKind.Player, sprites.dungeon.doorOpenNorth, function (sprite, location) {
|
|
if (canTP) {
|
|
music.knock.play()
|
|
tiles.placeOnRandomTile(mySprite, sprites.dungeon.doorClosedNorth)
|
|
canTP = 0
|
|
}
|
|
})
|
|
let canTP = 0
|
|
let px = 0
|
|
let projectile: Sprite = null
|
|
let py = 0
|
|
let level = 0
|
|
let levelStartMessage: string[] = []
|
|
let levels: tiles.TileMapData[] = []
|
|
let _type = 0
|
|
let typeSprite: Sprite = null
|
|
let mySprite: Sprite = null
|
|
scene.setBackgroundImage(assets.image`myImage`)
|
|
pause(500)
|
|
scene.setBackgroundImage(assets.image`myImage0`)
|
|
pause(100)
|
|
mySprite = sprites.create(img`
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . f f f f f f . . . . .
|
|
. . . f f e e e e f 2 f . . . .
|
|
. . f f e e e e f 2 2 2 f . . .
|
|
. . f e e e f f e e e e f . . .
|
|
. . f f f f e e 2 2 2 2 e f . .
|
|
. . f e 2 2 2 f f f f e 2 f . .
|
|
. f f f f f f f e e e f f f . .
|
|
. f f e 4 4 e b f 4 4 e e f . .
|
|
. f e e 4 d 4 1 f d d e f . . .
|
|
. . f e e e e e d d d f . . . .
|
|
. . . . f 4 d d e 4 e f . . . .
|
|
. . . . f e d d e 2 2 f . . . .
|
|
. . . f f f e e f 5 5 f f . . .
|
|
. . . f f f f f f f f f f . . .
|
|
. . . . f f . . . f f f . . . .
|
|
`, SpriteKind.Player)
|
|
scene.cameraFollowSprite(mySprite)
|
|
controller.moveSprite(mySprite, 100, 0)
|
|
mySprite.ay = 500
|
|
typeSprite = sprites.create(assets.image`red`, SpriteKind.Player)
|
|
_type = 0
|
|
levels = [
|
|
tilemap`level6`,
|
|
tilemap`level1`,
|
|
tilemap`level3`,
|
|
tilemap`level4`,
|
|
tilemap`level5`,
|
|
tilemap`level7`
|
|
]
|
|
levelStartMessage = [
|
|
"This is portal.py, you need to find the edgeless yum cube to find pass this test.",
|
|
"You now have a portal device, use b to place portals",
|
|
"You are much faster at this than the others",
|
|
"some portals require great timing",
|
|
"some portals require you to look up when you place them",
|
|
""
|
|
]
|
|
level = 5
|
|
music.setVolume(20)
|
|
for (let index = 0; index < 2; index++) {
|
|
music.playMelody("E B C5 A B G A F ", 220)
|
|
}
|
|
startLevel()
|
|
game.onUpdate(function () {
|
|
typeSprite.setPosition(scene.cameraProperty(CameraProperty.X) + scene.screenWidth() / 2 - 8, scene.cameraProperty(CameraProperty.Y) - scene.screenHeight() / 2 + 8)
|
|
})
|
|
game.onUpdateInterval(1000, function () {
|
|
canTP = 1
|
|
})
|
|
forever(function () {
|
|
|
|
})
|
|
forever(function () {
|
|
if (mySprite.vx < 0) {
|
|
mySprite.setImage(img`
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . f f f f f f . . . . . .
|
|
. . . f 2 f e e e e f f . . . .
|
|
. . f 2 2 2 f e e e e f f . . .
|
|
. . f e e e e f f e e e f . . .
|
|
. f e 2 2 2 2 e e f f f f . . .
|
|
. f 2 e f f f f 2 2 2 e f . . .
|
|
. f f f e e e f f f f f f f . .
|
|
. f e e 4 4 f b e 4 4 e f f . .
|
|
. . f e d d f 1 4 d 4 e e f . .
|
|
. . . f d d d e e e e e f . . .
|
|
. . . f e 4 e d d 4 f . . . . .
|
|
. . . f 2 2 e d d e f . . . . .
|
|
. . f f 5 5 f e e f f f . . . .
|
|
. . f f f f f f f f f f . . . .
|
|
. . . f f f . . . f f . . . . .
|
|
`)
|
|
px = -1
|
|
}
|
|
if (mySprite.vx > 0) {
|
|
mySprite.setImage(img`
|
|
. . . . . . . . . . . . . . . .
|
|
. . . . . f f f f f f . . . . .
|
|
. . . f f e e e e f 2 f . . . .
|
|
. . f f e e e e f 2 2 2 f . . .
|
|
. . f e e e f f e e e e f . . .
|
|
. . f f f f e e 2 2 2 2 e f . .
|
|
. . f e 2 2 2 f f f f e 2 f . .
|
|
. f f f f f f f e e e f f f . .
|
|
. f f e 4 4 e b f 4 4 e e f . .
|
|
. f e e 4 d 4 1 f d d e f . . .
|
|
. . f e e e e e d d d f . . . .
|
|
. . . . f 4 d d e 4 e f . . . .
|
|
. . . . f e d d e 2 2 f . . . .
|
|
. . . f f f e e f 5 5 f f . . .
|
|
. . . f f f f f f f f f f . . .
|
|
. . . . f f . . . f f f . . . .
|
|
`)
|
|
px = 1
|
|
}
|
|
})
|