Randomly Generated Platformer
@Stage\n\n@Intro\n\nwhen I start as a clone\nset size to (300) %\nif <(!d) = [1]> then\n    switch costume to (part 1 v)\n    point in direction (90)\n    go to x: (0) y: (0)\n    show\n    set [!d v] to [2]\n    create clone of (_myself_ v)\n    forever\n        go to [front v] layer\n    end\nelse\n    if <(!d) = [2]> then\n        switch costume to (part 2 v)\n        point in direction (90)\n        go to x: (-100) y: (100)\n        show\n        repeat (20)\n            change x by ((x position) * (-0.1))\n            change y by ((y position) * (-0.1))\n        end\n        set [!d v] to [3]\n        create clone of (_myself_ v)\n        repeat (30)\n            change x by ((x position) * (-0.1))\n            change y by ((y position) * (-0.1))\n        end\n    else\n        if <(!d) = [3]> then\n            go to [back v] layer\n            switch costume to (part 3 v)\n            point in direction (180)\n            go to x: (-67) y: (-62)\n            show\n            repeat (21)\n                turn left (7) degrees\n            end\n            set [!d v] to [4]\n            create clone of (_myself_ v)\n        else\n            if <(!d) = [4]> then\n                switch costume to (part 4 v)\n                set size to (20) %\n                point in direction (90)\n                go to x: (0) y: (0)\n                go to [front v] layer\n                show\n                repeat (10)\n                    change size by (((300) - (size)) * (0.1))\n                end\n                set [!d v] to [5]\n                create clone of (_myself_ v)\n                repeat (30)\n                    change size by (((300) - (size)) * (0.1))\n                end\n                set size to (300) %\n            else\n                if <(!d) = [5]> then\n                    switch costume to (part 5 v)\n                    set size to (10) %\n                    point in direction (97)\n                    go to x: (0) y: (0)\n                    go to [front v] layer\n                    show\n                    repeat (30)\n                        change size by (((300) - (size)) * (0.2))\n                        turn right (((300) - (size)) * (0.15)) degrees\n                    end\n                    set size to (300) %\n                    wait (0.5) seconds\n                    set [!d v] to [6]\n                    create clone of (_myself_ v)\n                else\n                    if <(!d) = [6]> then\n                        switch costume to (part 6 v)\n                        set size to (5) %\n                        point in direction (90)\n                        go to x: (0) y: (0)\n                        go to [front v] layer\n                        show\n                        repeat (45)\n                            change size by (((300) - (size)) * (0.2))\n                        end\n                        set size to (300) %\n                        wait (0.2) seconds\n                        broadcast (intro done v)\n                    end\n                end\n            end\n        end\n    end\nend\n\nwhen flag clicked\nhide\nwait (0.2) seconds\nset [!d v] to [1]\ncreate clone of (_myself_ v)\n\nwhen I receive [intro done v]\nstop [other scripts in sprite v]\ndelete this clone\n\n@player\n\ndefine platform\nchange [x spd v] by ((<key (right arrow v) pressed?> - <key (left arrow v) pressed?>) * (1.5))\nset [x spd v] to ((x spd) * (0.8))\nif <(x position) < [-232]> then\n    set x to (-232)\n    set [x spd v] to ((x spd) * (0.2))\nend\nchange x by (x spd)\nif <touching color (#000000)?> then\n    repeat until <not <touching color (#000000)?>>\n        change x by ((x spd) / (-4))\n    end\n    set [x spd v] to [0]\nend\nchange [y spd v] by (-1)\nchange y by (-10)\nif <<key (up arrow v) pressed?> and <touching color (#000000)?>> then\n    set [y spd v] to [10]\nend\nchange y by (10)\nchange y by (y spd)\nif <touching color (#000000)?> then\n    repeat until <not <touching color (#000000)?>>\n        change y by ((y spd) / (-4))\n    end\n    set [y spd v] to [0]\nend\nset size to (125) %\nif <<touching color (#090909)?> or <(y position) < [-199]>> then\n    broadcast (dead v)\nend\nif <(x position) > [245]> then\n    broadcast (next level v)\nend\nset size to (100) %\n\nwhen I receive [next level v]\nstop [other scripts in sprite v]\ngo to x: (-198) y: (0)\nchange [lvls in a row v] by (1)\nif <(died?) = [y]> then\n    set [lvls in a row v] to [0]\nelse\n    change [☁ total levels v] by (1)\n    if <(lvls in a row) > (☁ world best streak)> then\n        set [☁ world best streak v] to (lvls in a row)\n    end\n    if <(lvls in a row) > (your best)> then\n        set [your best v] to (lvls in a row)\n    end\nend\nset [died? v] to [n]\nset [x spd v] to [0]\nset [y spd v] to [0]\nforever\n    platform\nend\n\nwhen I receive [dead v]\nstop [other scripts in sprite v]\ngo to x: (-198) y: (0)\nset [x spd v] to [0]\nset [y spd v] to [0]\nset [died? v] to [y]\nset [lvls in a row v] to [0]\nforever\n    platform\nend\n\nwhen I receive [intro done v]\nshow\nset [died? v] to [y]\nbroadcast (next level v)\n\nwhen flag clicked\nset [lvls in a row v] to [0]\nset [your best v] to [0]\nhide\n\n@level\n\ndefine generate\nswitch costume to (aspect 1.1 v)\ndelete all of [aspects v]\ngo to x: (-216) y: (-100)\nset [aspect v] to [1]\nrepeat (2)\n    add [1] to [aspects v]\n    create clone of (_myself_ v)\n    change x by (48)\n    change [aspect v] by (1)\nend\nrepeat (8)\n    add (pick random (1) to (4)) to [aspects v]\n    if <(item (length of [aspects v]) of [aspects v]) = [2]> then\n        if <<(item ((length of [aspects v]) - (2)) of [aspects v]) = [3]> and <(item ((length of [aspects v]) - (1)) of [aspects v]) = [3]>> then\n            if <(y position) < [-149]> then\n                change y by (25)\n            else\n                if <(y position) < [-124]> then\n                    change y by (((letter (pick random (1) to (2)) of [13]) - (2)) * (25))\n                else\n                    if <(y position) > [99]> then\n                        change y by (((letter (pick random (1) to (2)) of [01]) - (2)) * (25))\n                    else\n                        change y by (((letter (pick random (1) to (3)) of [013]) - (2)) * (25))\n                    end\n                end\n            end\n        else\n            if <(y position) < [-149]> then\n                change y by (((letter (pick random (1) to (2)) of [34]) - (2)) * (25))\n            else\n                if <(y position) < [-124]> then\n                    change y by (((letter (pick random (1) to (3)) of [134]) - (2)) * (25))\n                else\n                    if <(y position) > [124]> then\n                        change y by (((letter (pick random (1) to (2)) of [01]) - (2)) * (25))\n                    else\n                        if <(y position) > [99]> then\n                            change y by (((letter (pick random (1) to (3)) of [013]) - (2)) * (25))\n                        else\n                            change y by (((letter (pick random (1) to (4)) of [0134]) - (2)) * (25))\n                        end\n                    end\n                end\n            end\n        end\n    end\n    if <(item (length of [aspects v]) of [aspects v]) = [4]> then\n        if << (join (item ((length of [aspects v]) - (1)) of [aspects v]) (item ((length of [aspects v]) + (1)) of [aspects v])) contains [1]?> or < (join (item ((length of [aspects v]) - (1)) of [aspects v]) (item ((length of [aspects v]) + (1)) of [aspects v])) contains [4]?>> then\n            switch costume to (aspect 4.2 v)\n        else\n            switch costume to (aspect 4.1 v)\n        end\n    else\n        if <<not <(item (length of [aspects v]) of [aspects v]) = [2]>> and << (join (item ((length of [aspects v]) - (1)) of [aspects v]) (item ((length of [aspects v]) + (1)) of [aspects v])) contains [1]?> or < (join (item ((length of [aspects v]) - (1)) of [aspects v]) (item ((length of [aspects v]) + (1)) of [aspects v])) contains [4]?>>> then\n            switch costume to (aspect 1.2 v)\n        else\n            switch costume to (aspect 1.1 v)\n        end\n    end\n    if <not <<(item (length of [aspects v]) of [aspects v]) = [3]> and <not <(item ((length of [aspects v]) - (2)) of [aspects v]) = [3]>>>> then\n        if <(item (length of [aspects v]) of [aspects v]) = [3]> then\n            replace item (length of [aspects v]) of [aspects v] with [1]\n        end\n        create clone of (_myself_ v)\n    end\n    change x by (48)\n    change [aspect v] by (1)\nend\nset [aspect v] to [none]\n\nwhen I receive [next level v]\nrepeat (1)\n    delete this clone\nend\ngenerate\nbroadcast (level generated v)\nhide\n\nwhen I receive [level generated v]\nif <not <(aspect) = [none]>> then\n    if <(item (aspect) of [aspects v]) = [4]> then\n        if << (join (item ((aspect) - (1)) of [aspects v]) (item ((aspect) + (1)) of [aspects v])) contains [1]?> or < (join (item ((aspect) - (1)) of [aspects v]) (item ((aspect) + (1)) of [aspects v])) contains [4]?>> then\n            if <(pick random (1) to (2)) = [1]> then\n                switch costume to (aspect 4.2 v)\n            else\n                switch costume to (aspect 4.1 v)\n            end\n        else\n            switch costume to (aspect 4.1 v)\n        end\n    else\n        if <<not <(item (aspect) of [aspects v]) = [2]>> and << (join (item ((aspect) - (1)) of [aspects v]) (item ((aspect) + (1)) of [aspects v])) contains [1]?> or < (join (item ((aspect) - (1)) of [aspects v]) (item ((aspect) + (1)) of [aspects v])) contains [4]?>>> then\n            if <(pick random (1) to (2)) = [1]> then\n                switch costume to (aspect 1.2 v)\n            else\n                switch costume to (aspect 1.1 v)\n            end\n        else\n            switch costume to (aspect 1.1 v)\n        end\n    end\n    show\nend\n\nwhen [space v] key pressed\nset [died? v] to [y]\nbroadcast (next level v)\n\n@death streak\n\nwhen I receive [intro done v]\ninitiate\n\nwhen I start as a clone\nswitch costume to (0 v)\nshow\nforever\n    go to x: ((-130) + (((!d) - (1)) * (7))) y: (162)\n    if <(!d) > (length of (lvls in a row))> then\n        hide\n    else\n        switch costume to (letter (!d) of (lvls in a row))\n        show\n    end\nend\n\nwhen flag clicked\nhide\n\ndefine initiate\nset [!d v] to [0]\nrepeat (15)\n    change [!d v] by (1)\n    create clone of (_myself_ v)\nend\nswitch costume to (text v)\ngo to x: (0) y: (0)\nshow\n\n@world best streak\n\nwhen I receive [intro done v]\ninitiate\n\nwhen I start as a clone\nswitch costume to (0 v)\nshow\nforever\n    go to x: ((-130) + (((!d) - (1)) * (7))) y: (126)\n    if <(!d) > (length of (☁ world best streak))> then\n        hide\n    else\n        switch costume to (letter (!d) of (☁ world best streak))\n        show\n    end\nend\n\nwhen flag clicked\nhide\n\ndefine initiate\nset [!d v] to [0]\nrepeat (15)\n    change [!d v] by (1)\n    create clone of (_myself_ v)\nend\nswitch costume to (text v)\ngo to x: (0) y: (0)\nshow\n\n@death streak3\n\nwhen I receive [intro done v]\ninitiate\n\nwhen I start as a clone\nswitch costume to (0 v)\nshow\nforever\n    go to x: ((-130) + (((!d) - (1)) * (7))) y: (144)\n    if <(!d) > (length of (your best))> then\n        hide\n    else\n        switch costume to (letter (!d) of (your best))\n        show\n    end\nend\n\nwhen flag clicked\nhide\n\ndefine initiate\nset [!d v] to [0]\nrepeat (15)\n    change [!d v] by (1)\n    create clone of (_myself_ v)\nend\nswitch costume to (text v)\ngo to x: (0) y: (0)\nshow\n\n@total levels beat\n\nwhen I receive [intro done v]\ninitiate\n\nwhen I start as a clone\nswitch costume to (0 v)\nshow\nforever\n    go to x: ((-129) + (((!d) - (1)) * (7))) y: (108)\n    if <(!d) > (length of (☁ total levels))> then\n        hide\n    else\n        switch costume to (letter (!d) of (☁ total levels))\n        show\n    end\nend\n\nwhen flag clicked\nhide\n\ndefine initiate\nset [!d v] to [0]\nrepeat (30)\n    change [!d v] by (1)\n    create clone of (_myself_ v)\nend\nswitch costume to (text v)\ngo to x: (0) y: (0)\nshow\n\nforever\n    broadcast (next level v)\nend\n\n@thumb\n\nwhen flag clicked\nhide\n\n