Scratch Platformer

Instructions: *** BUGS FIXED ***\n\nUse the arrow keys on the keyboard to move the cat.\n\nYou must reach the diamond of each of the levels to win the game. Don't touch ANYTHING RED.\n\n----------\n*** ERRORES REPARADOS ***\n\nUtiliza las flechas el teclado para mover al gato.\n\nDebes alcanzar el diamante de cada uno de los niveles para superar el juego. No toques NADA ROJO.

@Stage\n\nwhen stage clicked\nif <(backdrop [number v]) = [1]> then\n    reset timer\n    show variable [☁ world record v]\n    broadcast (Start v)\n    wait (0.01) seconds\n    set [game state v] to [ON]\n    broadcast (Next level v)\nend\n\nwhen flag clicked\nswitch backdrop to (thumbnail v)\nhide variable [level v]\nhide variable [your time v]\nhide variable [☁ world record v]\n\nwhen I receive [next level v]\nNext Blue Sky backdrop\nshow variable [level v]\nset [level v] to ([costume # v] of [ground v])\n\ndefine Next Blue Sky backdrop\nnext backdrop\nif <not < ([backdrop name v] of [_stage_ v]) contains [Blue Sky]?>> then\n    switch backdrop to (blue sky 1 v)\nend\n\nwhen [any v] key pressed\nif <(backdrop [number v]) = [1]> then\n    reset timer\n    show variable [☁ world record v]\n    broadcast (Start v)\n    wait (0.01) seconds\n    broadcast (Next level v)\nend\n\nwhen I receive [victory v]\nhide variable [level v]\nset [your time v] to (timer)\nshow variable [your time v]\nif <(YOUR TIME) < (☁ WORLD RECORD)> then\n    set [☁ world record v] to (YOUR TIME)\nend\n\n@Ground\n\nwhen flag clicked\nhide\nswitch costume to (no costume v)\nerase all\n\nwhen I receive [next level v]\nif <(Game state) = [ON]> then\n    show\n    next costume\n    Stamp shadow and outline\nelse\n    show\n    Stamp shadow and outline\nend\n\nwhen I receive [victory v]\nhide\nswitch costume to (no costume v)\nerase all\n\ndefine Stamp shadow and outline\nerase all\nclear graphic effects\nset [brightness v] effect to (-100)\nset [ghost v] effect to (70)\nchange x by (7)\nchange y by (-7)\nstamp\nchange x by (-7)\nchange y by (7)\nclear graphic effects\nStamp outline [2]\n\ndefine Stamp outline (width)\nclear graphic effects\nset rotation style [don't rotate v]\nset [brightness v] effect to (-100)\npoint in direction (90)\nrepeat (8)\n    move (width) steps\n    stamp\n    move ((width) * (-1)) steps\n    turn right (45) degrees\nend\nclear graphic effects\n\n@Box\n\nwhen flag clicked\nhide\nset [ghost v] effect to (0)\n\ndefine Gravity\nif <not <touching color (#0aff00)?>> then\n    change [y velocity v] by (-1)\nend\nif <touching color (#0aff00)?> then\n    set [y velocity v] to [0]\n    Replace Y (down)\nend\n\ndefine Replace Y (down)\nrepeat until <not <touching color (#0aff00)?>>\n    change y by (1)\nend\nchange y by (-1)\n\ndefine Replace X (right)\nrepeat until <not <touching color (#3f9914)?>>\n    change x by (-1)\nend\n\ndefine Replace X (left)\nrepeat until <not <touching color (#3f9914)?>>\n    change x by (1)\nend\n\ndefine Replace Y (up)\nif <(y velocity) > [0]> then\n    repeat until <not <touching color (#3f9914)?>>\n        set [y velocity v] to [0]\n        change y by (-1)\n    end\nend\n\nwhen I receive [start v]\ngo to x: (-215) y: (-20)\nforever\n    if <<key (up arrow v) pressed?> and <touching color (#0aff00)?>> then\n        start sound [Jump v]\n        set [y velocity v] to [13]\n    end\n    if <key (right arrow v) pressed?> then\n        change x by (8)\n        Replace X (right)\n    end\n    if <key (left arrow v) pressed?> then\n        change x by (-8)\n        Replace X (left)\n    end\n    change y by (y velocity)\n    Replace Y (up)\n    Gravity\nend\n\nwhen I receive [next level v]\nset [y velocity v] to [0]\ngo to x: (-215) y: (-20)\nset [y velocity v] to [0]\n\nwhen I receive [game over v]\nstop [other scripts in sprite v]\n\n@Crystal\n\nwhen flag clicked\nhide\nforever\n    repeat (20)\n        change y by (0.25)\n    end\n    repeat (20)\n        change y by (-0.25)\n    end\nend\n\nwhen I receive [next level v]\nif <(Game state) = [ON]> then\n    delete (1) of [x positions v]\n    delete (1) of [y positions v]\nend\nset [game state v] to [ON]\ngo to x: (item (1) of [x positions v]) y: (item (1) of [y positions v])\nwait (0.5) seconds\nset size to (0) %\nshow\nrepeat until <(size) > [99]>\n    change size by (2)\nend\nforever\n    if <touching (scratch cat v)?> then\n        hide\n        if <not <([costume # v] of [ground v]) = [10]>> then\n            broadcast (Next level v)\n            stop [this script v]\n        else\n            broadcast (Victory v)\n            stop [this script v]\n        end\n    end\nend\n\nwhen I receive [start v]\nif <(backdrop [number v]) = [1]> then\n    Add X positions\n    Add Y positions\nend\n\ndefine Add Y positions\ndelete all of [y positions v]\nadd [0] to [y positions v]\nadd [-34] to [y positions v]\nadd [87] to [y positions v]\nadd [-104] to [y positions v]\nadd [-46] to [y positions v]\nadd [-101] to [y positions v]\nadd [-101] to [y positions v]\nadd [-101] to [y positions v]\nadd [-101] to [y positions v]\nadd [160] to [y positions v]\nadd [-101] to [y positions v]\n\ndefine Add X positions\ndelete all of [x positions v]\nadd [0] to [x positions v]\nadd [220] to [x positions v]\nadd [220] to [x positions v]\nadd [220] to [x positions v]\nadd [220] to [x positions v]\nadd [220] to [x positions v]\nadd [220] to [x positions v]\nadd [220] to [x positions v]\nadd [220] to [x positions v]\nadd [-214] to [x positions v]\nadd [220] to [x positions v]\n\n@Dragon\n\nwhen flag clicked\nhide\n\nwhen I receive [next level v]\nwait (0.01) seconds\nif <([costume name v] of [ground v]) = [Level 03]> then\n    go to x: (120) y: (119)\n    show\n    forever\n        glide (1) secs to x: (120) y: (-75)\n        glide (1) secs to x: (120) y: (119)\n    end\nelse\n    hide\nend\n\nwhen I receive [start v]\nhide\n\n@GAME OVER\n\nwhen flag clicked\nhide\n\nwhen I receive [game over v]\nset [game state v] to [OFF]\npoint in direction (90)\nswitch costume to (game over v)\nset size to (0) %\nshow\nrepeat (20)\n    turn right (36) degrees\n    change size by (5)\nend\nwait (1) seconds\nrepeat (10)\n    turn right (36) degrees\nend\nnext costume\nrepeat (10)\n    turn right (36) degrees\nend\nforever\n    if <touching (mouse-pointer v)?> then\n        repeat until <(size) > [110]>\n            change size by (1)\n        end\n    else\n        repeat until <(size) < [106]>\n            change size by (-1)\n        end\n    end\nend\n\nwhen this sprite clicked\nif <(costume [number v]) = [2]> then\n    broadcast (Start v)\n    broadcast (Next level v)\n    hide\nend\n\nwhen I receive [start v]\nhide\n\n@Sprite1\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\nhide\n\nwhen I receive [victory v]\nswitch backdrop to (party v)\nset [color v] effect to (0)\ngo to x: (0) y: (188)\nhide\nwait (1.1) seconds\nshow\ngo to [front v] layer\nstart sound [Tada v]\nrepeat (33)\n    change y by (-10)\n    change [color v] effect by (20)\nend\nforever\n    change [color v] effect by (20)\nend\n\n@Red ball\n\nwhen flag clicked\nhide\n\nwhen I receive [start v]\ndelete this clone\n\nwhen I start as a clone\nif <([costume name v] of [ground v]) = [Level 07]> then\n    set size to (200) %\n    go to x: (-193) y: (138)\n    point in direction (90)\n    show\n    repeat until <not <([costume name v] of [ground v]) = [Level 07]>>\n        if <touching (ground v)?> then\n            set [red ball y velocity v] to [16]\n        end\n        change [red ball y velocity v] by (-1)\n        change y by (red ball y velocity)\n        move (7) steps\n        if on edge, bounce\n    end\n    delete this clone\nend\nif <([costume name v] of [ground v]) = [Level 05]> then\n    set size to (50) %\n    go to x: (pick random (-240) to (240)) y: (190)\n    show\n    repeat until <(y position) < [-178]>\n        change y by (-8)\n    end\n    delete this clone\nend\nif <([costume name v] of [ground v]) = [Level 10]> then\n    go to x: (0) y: (30)\n    point in direction (pick random (-179) to (180))\n    show\n    repeat until <not <([costume name v] of [ground v]) = [Level 10]>>\n        move (5) steps\n        if on edge, bounce\n    end\nend\nhide\n\nwhen I receive [victory v]\ndelete this clone\n\nwhen I receive [next level v]\nwait (0.5) seconds\nif <([costume name v] of [ground v]) = [Level 07]> then\n    create clone of (_myself_ v)\n    set size to (200) %\n    go to x: (187) y: (125)\n    point in direction (-90)\n    show\n    repeat until <not <([costume name v] of [ground v]) = [Level 07]>>\n        if <touching (ground v)?> then\n            set [red ball y velocity v] to [16]\n        end\n        change [red ball y velocity v] by (-1)\n        change y by (red ball y velocity)\n        move (7) steps\n        if on edge, bounce\n    end\nend\nif <([costume name v] of [ground v]) = [Level 06]> then\n    set size to (200) %\n    go to x: (187) y: (125)\n    point in direction (-90)\n    show\n    repeat until <not <([costume name v] of [ground v]) = [Level 06]>>\n        if <touching (ground v)?> then\n            set [red ball y velocity v] to [16]\n        end\n        change [red ball y velocity v] by (-1)\n        change y by (red ball y velocity)\n        move (7) steps\n        if on edge, bounce\n    end\nend\nif <([costume name v] of [ground v]) = [Level 05]> then\n    repeat until <not <([costume name v] of [ground v]) = [Level 05]>>\n        create clone of (_myself_ v)\n        wait (0.3) seconds\n    end\nend\nif <([costume name v] of [ground v]) = [Level 10]> then\n    set size to (50) %\n    repeat (10)\n        create clone of (_myself_ v)\n    end\nend\n\nwhen I receive [next level v]\nhide\ndelete this clone\n\nwhen I receive [next level v]\nwait (0.3) seconds\ndelete this clone\n\n@Red bars\n\nwhen flag clicked\nhide\n\nwhen I receive [next level v]\nwait (0.1) seconds\nif <([costume name v] of [ground v]) = [Level 08]> then\n    go to x: (31) y: (-271)\n    show\n    repeat until <not <([costume name v] of [ground v]) = [Level 08]>>\n        repeat (11)\n            change y by (10)\n        end\n        wait (1.5) seconds\n        repeat (11)\n            change y by (-10)\n        end\n        wait (1.5) seconds\n    end\nend\nhide\n\nwhen I receive [victory v]\nhide\n\n@Crab1\n\nwhen I receive [next level v]\nhide\nwait (0.1) seconds\nif <([costume # v] of [ground v]) = [9]> then\n    show\n    go to x: (139) y: (-56)\n    repeat until <not <([costume name v] of [ground v]) = [Level 09]>>\n        glide (2) secs to x: (-119) y: (-56)\n        glide (2) secs to x: (139) y: (-56)\n    end\n    hide\nend\n\nwhen I receive [next level v]\nwait (0.1) seconds\nif <([costume # v] of [ground v]) = [9]> then\n    repeat until <not <([costume name v] of [ground v]) = [Level 09]>>\n        next costume\n        wait (0.3) seconds\n    end\nend\n\nwhen flag clicked\nhide\n\n@Crab2\n\ngo to x: (-213) y: (60)\nrepeat until <not <([costume name v] of [ground v]) = [Level 09]>>\n    glide (2) secs to x: (100) y: (60)\n    glide (2) secs to x: (-213) y: (60)\nend\nhide\n\nwhen I receive [next level v]\nhide\nwait (0.1) seconds\nif <([costume # v] of [ground v]) = [9]> then\n    show\n    go to x: (-213) y: (60)\n    repeat until <not <([costume name v] of [ground v]) = [Level 09]>>\n        glide (2) secs to x: (100) y: (60)\n        glide (2) secs to x: (-213) y: (60)\n    end\n    hide\nend\n\nwhen I receive [next level v]\nwait (0.1) seconds\nif <([costume # v] of [ground v]) = [9]> then\n    repeat until <not <([costume name v] of [ground v]) = [Level 09]>>\n        next costume\n        wait (0.3) seconds\n    end\nend\n\nwhen flag clicked\nhide\n\n@Scratch Cat\n\nwhen I receive [next level v]\npoint in direction (90)\ngo to (box v)\nwait (0.01) seconds\nhide\nset rotation style [left-right v]\nset size to (30) %\nshow\n\nwhen I receive [start v]\nforever\n    if <key (any v) pressed?> then\n        if <<(y velocity) = [0]> and <touching (ground v)?>> then\n            next costume\n            if <(costume [number v]) > [16]> then\n                next costume\n            end\n        else\n            switch costume to (jump v)\n        end\n    else\n        switch costume to (stand v)\n    end\nend\n\nwhen I receive [next level v]\nforever\n    if <(Game state) = [ON]> then\n        go to (box v)\n        if <key (right arrow v) pressed?> then\n            point in direction (90)\n        end\n        if <key (left arrow v) pressed?> then\n            point in direction (-90)\n        end\n        if <<<touching color (#ff0000)?> or <touching (dragon v)?>> and <not <([backdrop name v] of [_stage_ v]) = [Party]>>> then\n            broadcast (Game over v)\n            stop [this script v]\n        end\n    end\nend\n\nwhen I receive [game over v]\nset size to (30) %\nrepeat (25)\n    change size by (-2)\nend\nhide\n\nwhen I receive [victory v]\nset [game state v] to [OFF]\nglide (1.1) secs to x: (0) y: (0)\n\nwhen I receive [victory v]\nset size to (30) %\nset rotation style [all around v]\nrepeat (36)\n    change size by (2.3)\n    turn right (20) degrees\nend\n\nwhen flag clicked\nhide\n\n@Dust\n\nwhen flag clicked\nhide\nforever\n    if <<(y velocity) < [0.1]> and <<key (right arrow v) pressed?> or <key (left arrow v) pressed?>>> then\n        wait (0.05) seconds\n        create clone of (_myself_ v)\n    end\nend\n\nwhen I start as a clone\nclear graphic effects\ngo to (scratch cat v)\nchange y by (-25)\npoint in direction (([direction v] of [scratch cat v]) - (pick random (130) to (230)))\nset size to (pick random (50) to (100)) %\nshow\nrepeat (20)\n    move (1) steps\n    change [ghost v] effect by (pick random (1) to (5))\nend\ndelete this clone\n\n