Gladiator

Gladiator game

The good mobs and the bad mobs meet each other in the arena.

Try the code:

let bad: number[] = []
let good: number[] = []
let index = 0
player.onChat("arena", function () {
    builder.teleportTo(player.position())
    builder.move(BACK, 10)
    builder.move(RIGHT, 10)
    builder.mark()
    for (let i = 0; i < 4; i++) {
        builder.move(FORWARD, 20)
        builder.turn(TurnDirection.Left)
    }
    builder.raiseWall(POLISHED_ANDESITE, 5)
})
player.onChat("spawn", function () {
    for (let index = 0; index <= good.length; index++) {
        mobs.spawn(good[index], pos(5, 0, index))
    }
    for (let index = 0; index <= bad.length; index++) {
        mobs.spawn(bad[index], pos(5, 0, index))
    }
})
good = [
    CHICKEN, COW, PIG,
    SHEEP, WOLF, VILLAGER,
    MUSHROOM_COW, SQUID, RABBIT,
    BAT, OCELOT, HORSE
]
bad = [
    mobs.monster(CREEPER), mobs.monster(SKELETON), mobs.monster(ZOMBIE),
    mobs.monster(SPIDER), mobs.monster(PIG_ZOMBIE), mobs.monster(SLIME),
    mobs.monster(ENDERMAN), mobs.monster(SILVERFISH), mobs.monster(CAVE_SPIDER),
    mobs.monster(GHAST), mobs.monster(LAVA_SLIME), mobs.monster(BLAZE)
]