controller.up.onEvent(ControllerButtonEvent.Pressed, function () {
Mushroom_Dancer.setPosition(60, 100)
})
controller.left.onEvent(ControllerButtonEvent.Pressed, function () {
Mushroom_Dancer.setPosition(30, 100)
})
info.onScore(10, function () {
game.over(true, effects.confetti)
})
controller.right.onEvent(ControllerButtonEvent.Pressed, function () {
Mushroom_Dancer.setPosition(130, 100)
})
sprites.onOverlap(SpriteKind.Player, SpriteKind.Projectile, function (sprite, otherSprite) {
otherSprite.destroy(effects.disintegrate, 100)
music.setVolume(10)
info.changeScoreBy(1)
})
controller.down.onEvent(ControllerButtonEvent.Pressed, function () {
Mushroom_Dancer.setPosition(100, 100)
})
info.onLifeZero(function () {
game.over(false, effects.melt)
})
scene.onHitWall(SpriteKind.Projectile, function (sprite, location) {
sprite.destroy(effects.fire, 100)
info.changeLifeBy(-1)
})
let Right: Sprite = null
let Down: Sprite = null
let Up: Sprite = null
let Left: Sprite = null
let Lane = 0
let Mushroom_Dancer: Sprite = null
tiles.setCurrentTilemap(tilemap`Main Level`)
effects.starField.startScreenEffect()
Mushroom_Dancer = sprites.create(img`
. . . . . . b b b b . . . . . .
. . . . b b 3 3 3 3 b b . . . .
. . . c b 3 3 3 3 1 1 b c . . .
. . c b 3 3 3 3 3 1 1 1 b c . .
. c c 1 1 1 3 3 3 3 1 1 3 c c .
c c d 1 1 1 3 3 3 3 3 3 3 b c c
c b d d 1 3 3 3 3 3 1 1 1 b b c
c b b b 3 3 1 1 3 3 1 1 d d b c
c b b b b d d 1 1 3 b d d d b c
. c b b b b d d b b b b b b c .
. . c c b b b b b b b b c c . .
. . . . c c c c c c c c . . . .
. . . . . . b 1 1 b . . . . . .
. . . . . . b 1 1 b b . . . . .
. . . . . b d d 1 1 b . . . . .
. . . . . b b b b b b . . . . .
`, SpriteKind.Player)
Mushroom_Dancer.setPosition(80, 100)
let Speed = 40
info.setScore(0)
info.setLife(3)
game.onUpdateInterval(2000, function () {
Lane = randint(1, 4)
if (Lane == 1) {
Left = sprites.create(assets.image`Left Arrow`, SpriteKind.Projectile)
Left.setVelocity(0, Speed)
Left.setPosition(30, 8)
} else if (Lane == 2) {
Up = sprites.create(assets.image`Up Mushroom`, SpriteKind.Projectile)
Up.setVelocity(0, Speed)
Up.setPosition(60, 8)
} else if (Lane == 3) {
Down = sprites.create(assets.image`Down Mushroom`, SpriteKind.Projectile)
Down.setVelocity(0, Speed)
Down.setPosition(100, 8)
} else {
Right = sprites.create(assets.image`Right Mushroom`, SpriteKind.Projectile)
Right.setVelocity(0, Speed)
Right.setPosition(130, 8)
}
})
Comments
Please log in or sign up to comment.