'How do I switch objects from a level into a child object without importing anything new in javascript?

How can I switch the frame of the bouncePad when the player collides with a lever without importing new stuff? Currently it just says the lever does not exist when the player tries to bounce.

Basically I want the character to bounce when it touches the bounce pad but only when the lever is turned on.

I am using replit so I cant have child objects in the addLevel function

addLevel([
        "            x",
        "   ======================",
        "            -----------===",
        "                         -=           /",
        "                                ========",
        "                  $            =--------",
        "            ============      =-",
        "",
        "                           x",
        "============================@=============================",
    ], {
        // define the size of each block
        width: 32,
        height: 32,
        // define what each symbol means, by a function returning    a component list (what will be passed to add())
        "=": () => [
            sprite("ground"),
            area(),
            solid(),
            "ground",
        ],
        "/": () => [
            sprite("lever"),
            pos(),
            area(),
            "lever"
        ],
        "-": () => [
            sprite("dirt"),
            area(),
            solid(),
            "ground"
        ],
        "@": () => [
            sprite("bouncePad"),
            pos(0, -1),
            area(),
            solid(),
            "bouncePad"
        ],
    })


    player.onCollide("bouncePad", (bouncePad) => {
        if (lever.frame == 2) {
            player.jump(JUMP_FORCE * 2)
        }
    })
    player2.onCollide("bouncePad", (bouncePad) => {
        if (lever.frame == 2) {
            player2.jump(JUMP_FORCE * 2)
        }
    })
    player.onCollide("lever", (lever) => {
        if (lever.frame == 0) {
            lever.play("switch")
            wait(0.2, () => {
                lever.stop()
                lever.frame = 2
                wait(0.3)
            })
            bouncePad.frame = 5
        }
    })
    player2.onCollide("lever", (lever) => {
        if (lever.frame == 0) {
            lever.play("switch")
            wait(0.2, () => {
                lever.stop()
                lever.frame = 2
                wait(0.3)
            })
        }
    })


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source