Thunder - A platformer

Instructions: + Spiky Dungeon +\n\nCan you escape it?\n\n+WASD or ARROW KEYS or TOUCH to move\n+ Avoid all saws and spiky shooters\n+ Find the exit at the end of each to level to pass onto the next\n+ Complete all 12 levels to win\n+ Your time is shown in seconds, the lower, the better!\n\n+ Music is Bumping by David Renda found at fesliyanstudios.com\n\n+ Sound effects made with Chiptone.com\n\n#5 on Trending Games! (as of May 20th, 2020)\n\nThanks to @TimMcCool for the turbo mode detector\n

@Stage\n\nwhen I receive [normal v]\nset [game v] to [0]\nstop [other scripts in sprite v]\nstop all sounds\n\nwhen I receive [mario v]\nif <(game) = [0]> then\n    set [game v] to [5]\n    forever\n        play sound [Mario v] until done\n    end\nend\n\nwhen I receive [fruit ninja v]\nif <(game) = [0]> then\n    set [game v] to [2]\n    forever\n        play sound [retry theme v] until done\n    end\nend\n\nwhen I receive [jetpack joyride v]\nif <(game) = [0]> then\n    set [game v] to [1]\n    forever\n        play sound [Jetpack Joyride v] until done\n    end\nend\n\nwhen I receive [color switch v]\nif <(game) = [0]> then\n    set [game v] to [4]\n    forever\n        play sound [ColorSwitch v] until done\n    end\nend\n\n@player\n\ndefine ah\nchange y by ((Yv) * (-1))\nif <(Yv) > [0]> then\n    repeat until <touching (ground v)?>\n        change y by (1)\n    end\nelse\n    repeat until <touching (ground v)?>\n        change y by (-1)\n    end\nend\nset [yv v] to [0]\n\nwhen I receive [normal v]\nclear graphic effects\nerase all\nhide variable [playerx v]\nhide variable [py v]\nstop [other scripts in sprite v]\nshow\nswitch backdrop to (backdrop2 v)\nswitch costume to (costume1 v)\npoint in direction (90)\nset rotation style [left-right v]\ngo to x: (-200) y: (-100)\nset [yv v] to [0]\nset [xv v] to [0]\nforever\n    change y by (-1)\n    if <(Yv) > [0]> then\n        change [yv v] by (-0.6)\n    else\n        change [yv v] by (-0.67)\n    end\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        change [xv v] by (1)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [xv v] by (-1)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    if <touching (ground v)?> then\n        change y by (1)\n        if <touching (ground v)?> then\n            change y by (1)\n            if <touching (ground v)?> then\n                change y by (1)\n                if <touching (ground v)?> then\n                    change y by (1)\n                    if <touching (ground v)?> then\n                        change y by (1)\n                        if <touching (ground v)?> then\n                            change x by ((Xv) * (-1))\n                            change x by (-1)\n                            change y by (-5)\n                            if <touching (null v)?> then\n                                change x by (10)\n                            end\n                            change x by (1)\n                            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                                if <(Xv) > [0]> then\n                                    set [xv v] to [-8]\n                                else\n                                    set [xv v] to [8]\n                                end\n                                set [yv v] to [10]\n                            else\n                                set [xv v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    change y by (Yv)\n    if <touching (ground v)?> then\n        ah\n    end\n    if <touching (ground v)?> then\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            set [yv v] to [11]\n        end\n    end\n    change y by (1)\n    if <<<(x position) > [238]> and <((level) mod (2)) = [1]>> and <(level) < [11]>> then\n        go to x: (-200) y: (-100)\n        set [yv v] to [0]\n        set [xv v] to [0]\n        change [level v] by (1)\n        broadcast (Normal v)\n    end\nend\n\nwhen I receive [jetpack joyride v]\nshow variable [playerx v]\nset [playerx v] to [0]\nstop [other scripts in sprite v]\nhide\nswitch backdrop to (backdrop3 v)\nswitch costume to (costume2 v)\nwait (1.2) seconds\nset [boom v] to [1]\nwait (0.2) seconds\nshow\nset rotation style [all around v]\npoint in direction (90)\nturn right (15) degrees\ngo to x: (-240) y: (-140)\nset [yv v] to [7]\nset [xv v] to [20]\nforever\n    if <(Yv) > [0]> then\n        change [yv v] by (-0.5)\n    else\n        change [yv v] by (-0.6)\n    end\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        change [xv v] by (0.9)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [xv v] by (-0.9)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    change y by (Yv)\n    switch costume to (costume2 v)\n    point in direction (90)\n    if <touching (ground v)?> then\n        change y by ((Yv) * (-1))\n        set [yv v] to [0]\n    end\n    if <(y position) < [-130]> then\n        point in direction (90)\n    else\n        point in direction (105)\n    end\n    change [playerx v] by (5)\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        change [yv v] by (2)\n        switch costume to (costume3 v)\n    else\n        switch costume to (costume2 v)\n    end\n    if <touching (zap v)?> then\n        die\n    end\n    go to [front v] layer\n    if <(playerX) > [5000]> then\n        set [xv v] to [20]\n        repeat (70)\n            if <(Yv) > [0]> then\n                change [yv v] by (-0.5)\n            else\n                change [yv v] by (-0.6)\n            end\n            set [xv v] to ((Xv) * (0.9))\n            change x by (Xv)\n            change y by (Yv)\n            switch costume to (costume2 v)\n            point in direction (90)\n            if <touching (ground v)?> then\n                change y by ((Yv) * (-1))\n                set [yv v] to [0]\n            end\n            if <(y position) < [-130]> then\n                point in direction (90)\n            else\n                point in direction (105)\n            end\n        end\n        change [level v] by (1)\n        broadcast (Normal v)\n    end\nend\n\nwhen flag clicked\nset size to (80) %\nset [level v] to [1]\n\nbroadcast (Normal v)\n\ndefine die\nset [yv v] to [10]\nset [xv v] to [4]\nrepeat until <(y position) < [-170]>\n    set [xv v] to ((Xv) * (0.99))\n    change x by (Xv)\n    change y by (Yv)\n    change [yv v] by (-0.7)\n    turn right (5) degrees\nend\nhide\nwait (1) seconds\nbroadcast (Jetpack Joyride v)\n\nbroadcast (Normal v)\n\nwhen I receive [fruit ninja v]\ndelete all of [px v]\ndelete all of [py v]\nhide variable [playerx v]\nstop [other scripts in sprite v]\nshow\nswitch backdrop to (wood v)\nswitch costume to (costume4 v)\npoint in direction (90)\nset rotation style [left-right v]\ngo to x: (-200) y: (-100)\nset [yv v] to [0]\nset [xv v] to [0]\nforever\n    change y by (-1)\n    if <(Yv) > [0]> then\n        change [yv v] by (-0.4)\n    else\n        change [yv v] by (-0.4)\n    end\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        change [xv v] by (1.5)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [xv v] by (-1.5)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    change y by (Yv)\n    if <touching (ground v)?> then\n        ah\n    end\n    if <touching (ground v)?> then\n        if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n            set [yv v] to [11]\n        end\n    end\n    change y by (1)\n    trail\nend\n\ndefine trail\ninsert (x position) at (1) of [px v] \ninsert (y position) at (1) of [py v] \nif <(length of [px v]) > [10]> then\n    delete (11) of [px v]\n    delete (11) of [py v]\nend\nerase all\nset [# v] to [1]\npen up\nset pen color to (#58a7e4)\nset pen size to (20)\nset pen (transparency v) to (0)\nrepeat (length of [px v])\n    go to x: (item (#) of [px v]) y: (item (#) of [py v])\n    pen down\n    change [# v] by (1)\n    change pen size by (-1.7)\n    change pen (transparency v) by (9.5)\nend\npen up\ngo to x: (item (1) of [px v]) y: (item (1) of [py v])\n\nwhen I receive [crossy road v]\nshow variable [py v]\nset size to (80) %\nset [py v] to [0]\nstop [other scripts in sprite v]\nshow\nswitch backdrop to (backdrop1 v)\nswitch costume to (costume1 v)\npoint in direction (90)\nset rotation style [all around v]\ngo to x: (0) y: (-120)\nforever\n    if <<<key (right arrow v) pressed?> or <key (d v) pressed?>> and <[180] > (x position)>> then\n        repeat (8)\n            change x by (7.5)\n        end\n    else\n        if <<<key (left arrow v) pressed?> or <key (a v) pressed?>> and <(x position) > [-180]>> then\n            repeat (8)\n                change x by (-7.5)\n            end\n        end\n    end\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        repeat (8)\n            change [py v] by (7.5)\n            set y to (-120)\n        end\n    end\nend\n\nif <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n    repeat (12)\n        change [py v] by (-6)\n        set y to (-144)\n    end\nend\n\nset y to (-120)\n\nwhen I receive [cdie v]\nstop [other scripts in sprite v]\nset rotation style [all around v]\nset size to (80) %\nrepeat (20)\n    turn right (15) degrees\n    change size by (-4)\nend\nwait (0.1) seconds\nbroadcast (Crossy Road v)\n\nwhen I receive [color switch v]\nclear graphic effects\nstop [other scripts in sprite v]\nbroadcast (c v)\nshow\nswitch backdrop to (backdrop4 v)\nswitch costume to (costume1 v)\npoint in direction (90)\nset rotation style [left-right v]\ngo to x: (0) y: (-100)\nset [yv v] to [0]\nset [xv v] to [0]\nset [py v] to [-100]\nset [camy v] to [0]\nset [col v] to [1]\nforever\n    change y by (-1)\n    if <(Yv) > [0]> then\n        change [yv v] by (-0.6)\n    else\n        change [yv v] by (-0.67)\n    end\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        change [xv v] by (1)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [xv v] by (-1)\n    end\n    set [xv v] to ((Xv) * (0.9))\n    change x by (Xv)\n    if <touching (ground v)?> then\n        change y by (1)\n        if <touching (ground v)?> then\n            change y by (1)\n            if <touching (ground v)?> then\n                change y by (1)\n                if <touching (ground v)?> then\n                    change y by (1)\n                    if <touching (ground v)?> then\n                        change y by (1)\n                        if <touching (ground v)?> then\n                            change x by ((Xv) * (-1))\n                            change x by (-1)\n                            change y by (-5)\n                            if <touching (null v)?> then\n                                change x by (10)\n                            end\n                            change x by (1)\n                            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                                if <(Xv) > [0]> then\n                                    set [xv v] to [-8]\n                                else\n                                    set [xv v] to [8]\n                                end\n                                set [yv v] to [10]\n                            else\n                                set [xv v] to [0]\n                            end\n                        end\n                    end\n                end\n            end\n        end\n    end\n    set y to ((pY) - (camY))\n    change [py v] by (Yv)\n    if <(y position) > [0]> then\n        change [camy v] by (y position)\n        set [camy v] to (round (camY))\n    end\n    if <(y position) = [-180]> then\n        broadcast (Color Switch v)\n    end\n    cd\nend\n\nwhen I receive [c v]\nrepeat until <<key (up arrow v) pressed?> or <key (w v) pressed?>>\n    if <(y position) < [-120]> then\n        set [yv v] to [6]\n    end\nend\nforever\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        set [yv v] to [6]\n        wait until <not <<key (up arrow v) pressed?> or <key (w v) pressed?>>>\n    end\nend\n\nwhen I receive [swap v]\nclear graphic effects\nif <(col) = [1]> then\n\ndefine cd\nif <touching color (#32e3f2)?> then\n    if <not <(col) = [1]>> then\n        broadcast (Color Switch v)\n    end\nelse\n    if <touching color (#8d0bfb)?> then\n        if <not <(col) = [2]>> then\n            broadcast (Color Switch v)\n        end\n    else\n        if <touching color (#ff0081)?> then\n            if <not <(col) = [3]>> then\n                broadcast (Color Switch v)\n            end\n        else\n            if <touching color (#f6e006)?> then\n                if <not <(col) = [4]>> then\n                    broadcast (Color Switch v)\n                end\n            end\n        end\n    end\nend\n\nbroadcast (swap v)\n\nwhen I receive [cw v]\nstop [other scripts in sprite v]\nrepeat until <(y position) = [180]>\n    change y by (Yv)\n    if <(Yv) > [-1]> then\n        change [yv v] by (-0.6)\n    else\n        set [yv v] to [6]\n    end\nend\nhide\nchange [level v] by (1)\nbroadcast (Normal v)\n\nwhen I receive [mario v]\nstop [other scripts in sprite v]\nclear graphic effects\nshow\nswitch backdrop to (backdrop5 v)\nswitch costume to (costume5 v)\npoint in direction (0)\nset rotation style [all around v]\ngo to x: (0) y: (0)\nset [yv v] to [0]\nset [xv v] to [0]\nset [px v] to [-747]\nset [py v] to [-150]\nforever\n    if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n        change [yv v] by (1.5)\n    end\n    if <<key (down arrow v) pressed?> or <key (s v) pressed?>> then\n        change [yv v] by (-0.75)\n    end\n    if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n        change [xv v] by (1)\n    end\n    if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n        change [xv v] by (-1)\n    end\n    turn right (Xv) degrees\n    if <touching (sprite2 v)?> then\n        set [xv v] to ((Xv) * (-1))\n        turn right (Xv) degrees\n    end\n    set [yv v] to ((Yv) * (0.9))\n    set [xv v] to ((Xv) * (0.9))\n    if <touching color (#46ab40)?> then\n        set [yv v] to ((Yv) * (0.8))\n        set [xv v] to ((Xv) * (0.8))\n    end\n    change [py v] by (([cos v] of (direction) ) * (Yv))\n    change [px v] by (([sin v] of (direction) ) * (Yv))\n    if <touching (sprite2 v)?> then\n        set [yv v] to ((Yv) * (-1))\n        repeat until <not <touching (sprite2 v)?>>\n            change [py v] by (([cos v] of (direction) ) * (Yv))\n            change [px v] by (([sin v] of (direction) ) * (Yv))\n        end\n    end\nend\n\nmove (Yv) steps\n\nwhen flag clicked\nhide\n\n@ground\n\nwhen I receive [normal v]\nshow\ngo to x: (0) y: (0)\nswitch costume to (level)\nwait (1) seconds\nif <(level) = [11]> then\n    start sound [Jackpot! The fat rat v]\nend\n\nwhen I receive [jetpack joyride v]\ngo to x: (0) y: (0)\nswitch costume to (costume11 v)\n\nwhen I receive [fruit ninja v]\ngo to x: (0) y: (0)\nswitch costume to (costume12 v)\n\nwhen I receive [crossy road v]\ngo to x: (0) y: (0)\nswitch costume to (costume13 v)\n\nwhen I receive [color switch v]\ngo to x: (0) y: (0)\nswitch costume to (costume14 v)\n\nwhen I receive [mario v]\ngo to x: (0) y: (0)\nswitch costume to (costume13 v)\n\nset [lap # v] to [4]\n\nwhen flag clicked\nhide\n\n@Jetpack World\n\nwhen I receive [jetpack joyride v]\nrepeat (1)\n    delete this clone\nend\nhide\ngo to x: (0) y: (0)\nset [myx v] to [0]\nrepeat (6)\n    create clone of (_myself_ v)\n    change [myx v] by (155)\nend\n\nwhen I start as a clone\nhide\ngo to [front v] layer\nshow\nforever\n    set x to ((myX) - ((playerX) mod (155)))\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [normal v]\nhide\ndelete this clone\n\n@Booms\n\nwhen I receive [jetpack joyride v]\nset [boom v] to [0]\nwait until <(boom) = [1]>\nspawn\n\nwhen I receive [normal v]\nhide\n\nwhen I start as a clone\nshow\nswitch costume to (pick random (1) to (4))\nset [rv v] to (pick random (-15) to (15))\nset [xv v] to (pick random (5) to (18))\nset [yv v] to (pick random (4) to (13))\nrepeat (20)\n    set x to ((myX) - (playerX))\n    change [ghost v] effect by (1)\n    change [myx v] by (xv)\n    set [xv v] to ((xv) * (0.99))\n    set [rv v] to ((rv) * (0.99))\n    change [yv v] by (-0.3)\n    change y by (yv)\n    turn right (rv) degrees\nend\nrepeat (80)\n    set x to ((myX) - (playerX))\n    change [ghost v] effect by (1)\n    change [myx v] by (xv)\n    set [xv v] to ((xv) * (0.99))\n    set [rv v] to ((rv) * (0.99))\n    change [yv v] by (-0.4)\n    change y by (yv)\n    turn right (rv) degrees\n    if <touching (ground v)?> then\n        set [rv v] to ((rv) * (0.5))\n        set [yv v] to ((yv) * (-0.7))\n        set [xv v] to ((xv) * (0.7))\n    end\nend\ndelete this clone\n\nwhen [space v] key pressed\nset [boom v] to [1]\n\ndefine spawn\npoint in direction (90)\nset [myx v] to [-230]\nset [playerx v] to [0]\ngo to x: (myX) y: (-135)\nrepeat (10)\n    create clone of (_myself_ v)\nend\n\n@App Icons\n\nwhen I receive [normal v]\nif <<((level) mod (2)) = [0]> and <(level) < [12]>> then\n    switch costume to ((level) / (2))\n    show\n    wait until <touching (player v)?>\n    setup ((level) / (2))\n    hide\nelse\n    hide\nend\n\ndefine setup (#)\nif <(#) = [1]> then\n    broadcast (Jetpack Joyride v)\nelse\n    if <(#) = [2]> then\n        broadcast (Fruit Ninja v)\n    else\n        if <(#) = [3]> then\n            broadcast (Crossy Road v)\n        else\n            if <(#) = [4]> then\n                broadcast (Color Switch v)\n            else\n                broadcast (mario v)\n            end\n        end\n    end\nend\n\n@ZAP\n\nwhen I start as a clone\nshow\npoint in direction ((pick random (-3) to (4)) * (45))\nif <((direction) mod (180)) = [0]> then\n    set y to (pick random (-58) to (30))\n    set [myx v] to ((playerX) + (250))\nelse\n    set y to (pick random (-73) to (45))\n    set [myx v] to ((playerX) + (325))\nend\nrepeat until <(x position) < [-250]>\n    set x to ((myX) - (playerX))\nend\ndelete this clone\n\nwhen I start as a clone\nforever\n    wait (0.1) seconds\n    next costume\nend\n\nwhen I receive [jetpack joyride v]\nrepeat (1)\n    delete this clone\nend\nwait (4) seconds\nhide\ngo to x: (0) y: (-73)\nforever\n    create clone of (_myself_ v)\n    wait ((1) * (pick random (1.5) to (2.5))) seconds\nend\n\nwhen I receive [normal v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nrepeat (1)\n    delete this clone\nend\n\n@Wall JJR\n\nwhen flag clicked\nhide\n\nwhen I receive [jetpack joyride v]\nshow\ngo to x: (0) y: (0)\ngo to [back v] layer\nwait (0.1) seconds\nwait until <(boom) = [1]>\nwait (0.1) seconds\nrepeat (5)\n    change x by (-1)\nend\nhide\n\nwhen I receive [normal v]\nhide\n\n@Jetpack World2\n\nwhen I receive [jetpack joyride v]\nrepeat (1)\n    delete this clone\nend\nhide\ngo to x: (0) y: (0)\nset [myx v] to [70]\nrepeat (2)\n    create clone of (_myself_ v)\n    change [myx v] by (700)\nend\n\nwhen I start as a clone\nhide\ngo to [back v] layer\nshow\nforever\n    set x to ((myX) - ((playerX) mod (700)))\n    if <(x position) > [580]> then\n        hide\n    else\n        show\n    end\nend\n\nwhen flag clicked\nhide\n\nwhen I receive [normal v]\nhide\ndelete this clone\n\nif <[-564] > (x position)> then\n    hide\nelse\n    show\nend\n\n@Fruit\n\nwhen I start as a clone\nif <(type) = [1]> then\n    switch costume to (fruity)\n    show\n    go to x: (pick random (-200) to (200)) y: (-180)\n    set [rv v] to (pick random (-15) to (15))\n    if <(x position) < [0]> then\n        set [xv v] to (pick random (-1.) to (7))\n    else\n        set [xv v] to (pick random (-7) to (1.))\n    end\n    set [yv v] to (pick random (8) to (13))\n    repeat (10)\n        change x by (xv)\n        change y by (yv)\n        set [xv v] to ((xv) * (0.99))\n        change [yv v] by (-0.3)\n        turn right (rv) degrees\n    end\n    repeat until <<(y position) < [-170]> or <touching (player v)?>>\n        change x by (xv)\n        change y by (yv)\n        set [xv v] to ((xv) * (0.99))\n        change [yv v] by (-0.3)\n        turn right (rv) degrees\n    end\n    if <touching (player v)?> then\n        d\n        change [fruit sliced: v] by (1)\n        hide\n        play sound [slice-1 v] until done\n    end\n    delete this clone\nelse\n    if <(type) = [2]> then\n        switch costume to ((fruity) + (1))\n        change [xv v] by (pick random (-7) to (7.))\n        change [yv v] by (pick random (-0.5) to (5))\n        change [rv v] by (pick random (-5) to (5.))\n        repeat until <(y position) < [-170]>\n            change x by (xv)\n            change y by (yv)\n            set [xv v] to ((xv) * (0.99))\n            change [yv v] by (-0.3)\n            turn right (rv) degrees\n        end\n        delete this clone\n    else\n        turn right (pick random (1) to (720)) degrees\n        switch costume to ((fruity) + (2))\n        set [xv v] to (pick random (-4.) to (4))\n        set [yv v] to (pick random (5) to (9))\n        repeat until <(y position) < [-170]>\n            change x by (xv)\n            change y by (yv)\n            set [xv v] to ((xv) * (0.99))\n            change [yv v] by (-0.3)\n        end\n        delete this clone\n    end\nend\n\nwhen I receive [fruit ninja v]\nshow variable [fruit sliced: v]\nrepeat (1)\n    delete this clone\nend\nset [fruit sliced: v] to [0]\nset [type v] to [1]\nhide\nstop [other scripts in sprite v]\nrepeat (60)\n    wait (pick random (0.3) to (1)) seconds\n    set [fruity v] to ((1) + ((pick random (0) to (3)) * (3)))\n    create clone of (_myself_ v)\nend\nif <(Fruit Sliced:) > [29]> then\n    wait (5) seconds\n    change [level v] by (1)\n    broadcast (Normal v)\nelse\n    wait (5) seconds\n    broadcast (Fruit Ninja v)\nend\n\nwhen flag clicked\nhide\n\ndefine d\nset [type v] to [2]\ncreate clone of (_myself_ v)\nturn right (180) degrees\ncreate clone of (_myself_ v)\nset [type v] to [3]\nrepeat (pick random (3) to (5))\n    create clone of (_myself_ v)\nend\n\nwhen I receive [normal v]\nhide variable [fruit sliced: v]\nstop [other scripts in sprite v]\nhide\ndelete this clone\n\nbroadcast (Normal v)\n\nset [# v] to [0]\n\nwhen I receive [fruit ninja v]\n\n@Crossy Road\n\nwhen I receive [crossy road v]\nhide\nstop [other scripts in sprite v]\nrepeat (1)\n    delete this clone\nend\nh\nset [myy v] to [0]\nset [type v] to [1]\nforever\n    wait until <(pY) > ((myY) - (310))>\n    switch costume to (pick random (1) to (5))\n    change [myy v] by ((item (costume [number v]) of [heights v]) * (60))\n    create clone of (_myself_ v)\n    if <(pY) > [2000]> then\n        change [level v] by (1)\n        broadcast (Normal v)\n    end\nend\n\nwhen I start as a clone\nset x to (0)\nif <(type) = [1]> then\n    show\n    go to [back v] layer\n    repeat until <(pY) > ((myY) + (200))>\n        set y to ((myY) - (pY))\n        hide\n        if <(y position) = ((myY) - (pY))> then\n            show\n        end\n    end\n    delete this clone\nelse\n    switch costume to (pick random (6) to (9))\n    show\n    go to [front v] layer\n    if <(letter (id) of (dir)) = [1]> then\n        point in direction (-90)\n        set x to (240)\n    else\n        point in direction (90)\n        set x to (-240)\n    end\n    repeat until <(pY) > ((myY) - (-380))>\n        set y to (((myY) - (pY)) - (((id) - (1)) * (60)))\n        hide\n        if <(y position) = (((myY) - (pY)) - (((id) - (1)) * (60)))> then\n            show\n        end\n        set [x v] to (x position)\n        move ((letter (id) of (speed)) * (4)) steps\n        if <touching (player v)?> then\n            broadcast (cDie v)\n        end\n        if <(x) = (x position)> then\n            delete this clone\n        end\n    end\n    delete this clone\nend\n\nchange [myy v] by (72)\n\ndefine h\ndelete all of [heights v]\nadd [1] to [heights v]\nadd [2] to [heights v]\nadd [3] to [heights v]\nadd [1] to [heights v]\nadd [1] to [heights v]\n\nwhen I start as a clone\nwait (0.1) seconds\nif <<(type) = [1]> and <(costume [number v]) < [4]>> then\n    set [dir v] to (join (pick random (0) to (1)) (join (pick random (0) to (1)) (pick random (0) to (1))))\n    set [speed v] to (join (pick random (1) to (2)) (join (pick random (1) to (2)) (pick random (1) to (2))))\n    set [type v] to [2]\n    forever\n        set [id v] to (pick random (1) to (costume [number v]))\n        wait (pick random ((2.) / (costume [number v])) to ((6) / (costume [number v]))) seconds\n        create clone of (_myself_ v)\n    end\nend\n\nwhen I receive [normal v]\nhide\nstop [other scripts in sprite v]\nrepeat (1)\n    delete this clone\nend\n\n@Color Switch\n\nwhen I receive [color switch v]\nset [myy v] to [40]\nforever\n    go to x: (0) y: ((myY) - (camY))\n    turn right (3) degrees\n    hide\n    if <([floor v] of (y position) ) = ([floor v] of ((myY) - (camY)) )> then\n        show\n    end\nend\n\nwhen I receive [normal v]\nhide\nstop [other scripts in sprite v]\nrepeat (1)\n    delete this clone\nend\n\n@Color Switch2\n\nwhen I receive [color switch v]\npoint in direction (90)\nset [myy v] to [400]\nforever\n    go to x: (108) y: ((myY) - (camY))\n    turn right (3) degrees\n    if <([floor v] of (y position) ) = ([floor v] of ((myY) - (camY)) )> then\n        show\n    else\n        hide\n    end\nend\n\nwhen I receive [normal v]\nhide\nstop [other scripts in sprite v]\nrepeat (1)\n    delete this clone\nend\n\n@Color Switch4\n\nwhen I receive [color switch v]\npoint in direction (90)\nset [myy v] to [700]\nforever\n    go to x: (0) y: ((myY) - (camY))\n    turn right (-3) degrees\n    hide\n    if <([floor v] of (y position) ) = ([floor v] of ((myY) - (camY)) )> then\n        show\n    end\nend\n\nwhen I receive [normal v]\nhide\nstop [other scripts in sprite v]\nrepeat (1)\n    delete this clone\nend\n\n@Color Switch5\n\nwhen I receive [color switch v]\nrepeat (1)\n    delete this clone\nend\npoint in direction (90)\nset [myy v] to [40]\nswitch costume to (costume4 v)\ncreate clone of (_myself_ v)\nset [myy v] to [250]\nswitch costume to (costume3 v)\ncreate clone of (_myself_ v)\nset [myy v] to [500]\nswitch costume to (costume2 v)\ncreate clone of (_myself_ v)\n\nwhen I start as a clone\nforever\n    go to x: (0) y: ((myY) - (camY))\n    hide\n    if <([floor v] of (y position) ) = ([floor v] of ((myY) - (camY)) )> then\n        show\n    end\n    if <touching (player v)?> then\n        set [col v] to (costume [number v])\n        broadcast (swap v)\n        delete this clone\n    end\nend\n\nwhen I receive [normal v]\nhide\nstop [other scripts in sprite v]\nrepeat (1)\n    delete this clone\nend\n\n@Color Switch3\n\nwhen I receive [color switch v]\npoint in direction (90)\nset [myy v] to [400]\nforever\n    go to x: (-108) y: ((myY) - (camY))\n    turn right (-3) degrees\n    if <([floor v] of (y position) ) = ([floor v] of ((myY) - (camY)) )> then\n        show\n    else\n        hide\n    end\nend\n\nwhen I receive [normal v]\nhide\nstop [other scripts in sprite v]\nrepeat (1)\n    delete this clone\nend\n\n@Color Switch6\n\nwhen I receive [color switch v]\nrepeat (1)\n    delete this clone\nend\npoint in direction (90)\nswitch costume to (costume1 v)\nset [myy v] to [900]\nrepeat (4)\n    create clone of (_myself_ v)\n    change [myy v] by (40)\nend\n\nwhen I start as a clone\nforever\n    go to x: (([cos v] of (((timer) + (((myY) mod (900)) / (5))) * (50)) ) * (90)) y: ((myY) - (camY))\n    hide\n    if <([floor v] of (y position) ) = ([floor v] of ((myY) - (camY)) )> then\n        show\n    end\nend\n\nwhen I receive [normal v]\nhide\nstop [other scripts in sprite v]\nrepeat (1)\n    delete this clone\nend\n\n@Color Switch7\n\nwhen I receive [color switch v]\npoint in direction (90)\nset [myy v] to [1100]\nforever\n    go to x: (0) y: ((myY) - (camY))\n    hide\n    go to [back v] layer\n    if <([floor v] of (y position) ) = ([floor v] of ((myY) - (camY)) )> then\n        show\n    end\n    if <touching (player v)?> then\n        broadcast (cw v)\n    end\nend\n\nwhen I receive [normal v]\nhide\nstop [other scripts in sprite v]\nrepeat (1)\n    delete this clone\nend\n\n@Sprite1\n\nwhen I receive [mario v]\nshow\nforever\n    go to [back v] layer\n    go [forward v] (1) layers\n    switch costume to (costume2 v)\n    set size to (500) %\n    switch costume to (costume1 v)\n    go to x: ((0) - (PX)) y: ((0) - (PY))\nend\n\nwhen I receive [normal v]\nstop [other scripts in sprite v]\nhide\n\n@Sprite2\n\nwhen I receive [mario v]\nshow\nforever\n    go to [back v] layer\n    switch costume to (costume2 v)\n    set size to (500) %\n    switch costume to (costume1 v)\n    go to x: ((0) - (PX)) y: ((0) - (PY))\nend\n\nwhen I receive [normal v]\nhide variable [time left: v]\nhide variable [lap # v]\nstop [other scripts in sprite v]\nhide\n\nwhen I receive [mario v]\nshow variable [time left: v]\nshow variable [lap # v]\nset [lap # v] to [1]\nset [time left: v] to [95]\nwait until <key (any v) pressed?>\nrepeat until <<(Time Left:) = [0]> or <(Lap #) = [4]>>\n    wait (1) seconds\n    change [time left: v] by (-1)\nend\nif <(Lap #) = [4]> then\n    set [lap # v] to [Winner!]\nend\nwait (5) seconds\nif <(Lap #) = [Winner!]> then\n    change [level v] by (1)\n    broadcast (Normal v)\nelse\n    broadcast (mario v)\nend\n\n@Sprite3\n\nwhen I receive [mario v]\nshow\nset [ghost v] effect to (100)\nforever\n    go to [back v] layer\n    go [forward v] (1) layers\n    switch costume to (costume2 v)\n    set size to (500) %\n    switch costume to (costume1 v)\n    go to x: ((0) - (PX)) y: ((0) - (PY))\nend\n\nwhen I receive [mario v]\nset [lap # v] to [1]\nrepeat until <(Lap #) = [4]>\n    wait until <<touching (player v)?> and <(PX) > [0]>>\n    wait until <<touching (player v)?> and <[0] > (PX)>>\n    change [lap # v] by (1)\nend\n\nwhen I receive [normal v]\nstop [other scripts in sprite v]\nhide\n\n@Sprite4\n\nwhen I receive [normal v]\nhide\nstop [other scripts in sprite v]\n\nwhen I receive [mario v]\nset size to (100) %\nhide\nwait (1) seconds\nwait until <(Lap #) = [4]>\nshow\nrepeat (10)\n    go to [front v] layer\n    change size by (30)\nend\n\n@Sprite5\n\nset volume to (100) %\n\n@Sprite6\n\nwhen flag clicked\ngo to [front v] layer\nset [ghost v] effect to (100)\n\n@Sprite7\n\n@Intro\n\nwhen flag clicked\nif <(played?) = [0]> then\n    set [played? v] to [1]\n    start sound [Royalty Free - Hero Theme 5BSting5D v]\n    go to x: (0) y: (0)\n    set size to (80) %\n    hide\n    erase all\n    set [special? v] to [1]\n    create clone of (_myself_ v)\n    set [special? v] to [0]\n    clone\n    set [special? v] to [2]\n    create clone of (_myself_ v)\n    set [special? v] to [3]\n    wait (4) seconds\n    switch costume to (costume32 v)\n    set size to (20) %\n    show\n    switch costume to (costume6 v)\n    point in direction (90)\n    set rotation style [all around v]\n    repeat (15)\n        change size by (4)\n        turn right (24) degrees\n    end\n    wait (0.5) seconds\n    broadcast (logo1 v)\nelse\n    broadcast (Normal v)\nend\n\nwhen I start as a clone\nif <(special?) = [1]> then\n    show\n    go to [back v] layer\n    set size to (100) %\n    switch costume to (costume32 v)\nelse\n    if <(special?) = [0]> then\n        wait (pick random (0.0) to (2)) seconds\n        show\n        move\n        glide (1.5) secs to x: (0) y: (0)\n    end\nend\n\ndefine clone\nswitch costume to (costume29 v)\nrepeat until <(costume [number v]) = [1]>\n    create clone of (_myself_ v)\n    next costume\nend\n\ndefine move\nset rotation style [don't rotate v]\npoint in direction (pick random (1) to (1000000))\nrepeat until <touching (_edge_ v)?>\n    move (10) steps\nend\nmove (20) steps\n\nwhen I receive [logo1 v]\nif <(special?) = [0]> then\n    set rotation style [don't rotate v]\n    point in direction (((costume [number v]) - (8)) * (14.4))\n    set [vroom v] to [10]\n    repeat until <touching (_edge_ v)?>\n        move (vroom) steps\n        set [vroom v] to ((vroom) * (0.98))\n    end\n    repeat (2)\n        move (vroom) steps\n        set [vroom v] to ((vroom) * (0.98))\n    end\n    delete this clone\nelse\n    wait (1.5) seconds\n    if <(special?) = [3]> then\n        broadcast (Normal v)\n    end\n    repeat (20)\n        change [ghost v] effect by (5)\n        go to [front v] layer\n    end\n    hide\n    delete this clone\nend\n\nset [played? v] to [0]\n\n