Escape the Caverns - Blocky Platformer 2


@Stage\n\nwhen flag clicked\nbroadcast (! initalise v)\nwait (0) seconds\nswitch backdrop to (cave v)\nwait until <(Level) = [10]>\nswitch backdrop to (surface v)\n\nwhen I receive [! initalise v]\nforever\n    play sound [411096__zeraora__cave-ambient-02 v] until done\nend\n\n@1\n\nwhen I receive [! initalise v]\nhide\nset [clone? v] to [0]\nset [level v] to [1]\nset size to (432) %\nswitch costume to (a v)\ncreate levels\nrender\n\nwhen this sprite clicked\nif <(Level creator) = [1]> then\n    if <key (a v) pressed?> then\n        switch costume to ((costume [number v]) - (1))\n    end\n    if <key (space v) pressed?> then\n        switch costume to (a v)\n    else\n        next costume\n        if <(costume [number v]) = [1]> then\n            next costume\n        end\n    end\nend\n\ndefine render\nerase all\nswitch costume to (a v)\ngo to x: (-221) y: (-153)\nset [count1 v] to [0]\nrepeat (10)\n    repeat (14)\n        change [count1 v] by (1)\n        switch costume to (letter (count1) of (item (Level) of [levels v]))\n        if <(costume [number v]) = [16]> then\n            stamp\n        else\n            create clone of (_myself_ v)\n        end\n        change x by (34)\n    end\n    set x to (-221)\n    change y by (34)\nend\n\nwhen I receive [create level v]\nif <(clone?) = [1]> then\n    if <(count1) = (count2)> then\n        replace item (1) of [levels v] with (join (item (1) of [levels v]) (letter (costume [number v]) of [abcdefghijklmnopqrstuvwxyz]))\n    end\nend\n\ndelete (all) of [levels v]\nadd [] to [levels v]\nset [count2 v] to [1]\nrepeat (140)\n    broadcast (create level v)\n    change [count2 v] by (1)\nend\nbroadcast (create level v)\n\ndefine create levels\ndelete (all) of [levels v]\nif <(Level creator) = [1]> then\n    add [n] to [levels v]\nelse\n    add [bcbbbfbbbbbbbbbccbfbbbbaagbbbbbcffbdaaaafbbbcbbbbaaaaabbabbbbbbaaaddbbaaaabddaadbbbbdaaaaadaadbbbbbdaaaaaafbbbcfbbdaaaadbbcccbfbbeebbbbfcdcc] to [levels v]\n    add [dddbfiibbbbbcbcddiiiiibbcbcbcdhdhfhdbdccbcddadabaadagbccaaaaaaaaaaaacbaaaaaaaaaaaaddaaaaaaaaaabbcbbddaaaaadbbbbbbbbededbbbfbbbbfbbbbbbbbbbbf] to [levels v]\n    add [iidfiidccdcdddiiiiiiiiiddgddhhhhhhhhhhdadhccaaaaaaaaaaaaaaacaaaaaaaaaaaaaaadaaaaaaaaaaaaajaaeaaaacdaaaaaaaaaaaddccdaaaaaaaaecdbcbcbbcdbcdccf] to [levels v]\n    add [cfbccbdlccjbbcdcidaaaaaaadbdddcbajacaaaabdladfaaccebcabcaakbaacbllaabdaaafbadbaaaabdmaabcadcaajebddabdaacdaaagcidaaaaadbeaaabhhdaaadbfbbbbbb] to [levels v]\n    add [bfbhdhhchhdfbcdbcaaaaaaajacdddaaaaaaaaaaacdbaaaaaaaaaaaaaaaanaaaaadfaanncbcbccbjcbaancdchbhhcmcaaadgaaaaaaadaaaebaaaaaaaaaaaddcbdbcbcbfcffc] to [levels v]\n    add [ccbhhbhhbnlibcdcbaaaaaaaaibdcaaaaaaaacaibcaacaaacacbaiiaaacmcdcebcaiiccdccbccaaaaibcccbgcaaacaaiidcdcaaabddaahhcccbcccdddcaakcfbcbcbbdbbebc] to [levels v]\n    add [dddbbnbnnnbnnndccdnbbnbnnagabdbnbnnaaaaaaaaaadnaaaaaaaaaaaaaaaannnnnnbaaacnnnnnbnnnnebnnnnnnnnnbnnbcbnbbnnnnnnnndbbnnnnnnnnnnnddnbnnnbnnnnnn] to [levels v]\n    add [bnnnnnqnnnnqqnobpppnnqnnqnnbaaaaabnpppnqqaaaaaaabaaabnnaaaaaaaaaaaagnaqnaaaaaaaaaanbnqeaaaaaaannnnbnqbaaaenbnnnbnbqnnbnonnqnnbbnnnnnnnnnnnn] to [levels v]\n    add [nnnnnnqnnnilinnqgaaaaajiiainqnnnnnaaannaipppndhhqaaaaahaaqnnaaaqnqqanqaabnaaaacnnannaaonaaqaoqaannnaanaanaaaaanqnaaaabnaaaaecnnnnqqnnqnqdpp] to [levels v]\n    add [bnnnnqnbqnbnqqnbpppnpppqnnnnaaaaaaaaaancnnaaabnaaaaaaqnnadcbqbneqnanbqccccdcrrraacqrrrrrrraaaarrraaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa] to [levels v]\nend\n\nwhen I start as a clone\nset [clone? v] to [1]\nshow\nswitch costume to (letter (count1) of (item (Level) of [levels v]))\nwait (0) seconds\n\nwhen I receive [level next v]\nwait (0) seconds\nswitch costume to (letter (count1) of (item (Level) of [levels v]))\nif <(clone?) = [1]> then\n    show\nend\nif <(costume [number v]) = [7]> then\n    replace item (1) of [end v] with (x position)\n    replace item (2) of [end v] with (y position)\nend\nif <(costume [number v]) = [16]> then\n    stamp\n    hide\nend\n\nset [level v] to [8]\nbroadcast (level next v)\n\n@player\n\nwhen I receive [reset v]\ngo to x: (-225) y: (-22)\nset [xv v] to [0]\nset [yv v] to [0]\n\nwhen I receive [level next v]\nerase all\nchange [level v] by (1)\nbroadcast (reset v)\n\nwhen I receive [! initalise v]\nif <(Level creator) = [0]> then\n    go to x: (-225) y: (-22)\n    show\n    set [fails v] to [0]\n    set [xv v] to [0]\n    set [yv v] to [0]\n    forever\n        if <<key (right arrow v) pressed?> or <key (d v) pressed?>> then\n            change [xv v] by (1)\n            point in direction (90)\n        end\n        if <<key (left arrow v) pressed?> or <key (a v) pressed?>> then\n            change [xv v] by (-1)\n            point in direction (-90)\n        end\n        set [xv v] to ((Xv) * (0.9))\n        if <touching color (#006622)?> then\n            set [xv v] to ((Xv) * (0.8))\n        end\n        change x by (Xv)\n        set size to (260) %\n        if <<(y position) < [-165]> or <<touching color (#ff5305)?> or <touching color (#ffc10a)?>>> then\n            start sound [burn v]\n            broadcast (lava v)\n            broadcast (reset v)\n        end\n        set size to (220) %\n        if <touching (1 v)?> then\n            change y by (1)\n            if <touching (1 v)?> then\n                change y by (1)\n                if <touching (1 v)?> then\n                    change y by (1)\n                    if <touching (1 v)?> then\n                        change y by (1)\n                        if <touching (1 v)?> then\n                            change y by (1)\n                            if <touching (1 v)?> then\n                                change x by ((Xv) * (-1))\n                                change y by (-5)\n                                if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                                    if <(Xv) > [0]> then\n                                        set [xv v] to [-5]\n                                    else\n                                        set [xv v] to [5]\n                                    end\n                                    set [yv v] to [12]\n                                    start sound (pick random (1) to (5))\n                                else\n                                    set [xv v] to [0]\n                                end\n                            end\n                        end\n                    end\n                end\n            end\n        end\n        change [yv v] by (-1)\n        change y by (Yv)\n        if <touching (1 v)?> then\n            change y by ((Yv) * (-1))\n            set [yv v] to [0]\n        end\n        change y by (-1)\n        if <touching (1 v)?> then\n            if <<key (up arrow v) pressed?> or <key (w v) pressed?>> then\n                if <touching color (#006622)?> then\n                    set [yv v] to [18]\n                else\n                    if <touching color (#71b8ff)?> then\n                        change [yv v] by (10)\n                        start sound [splash v]\n                    else\n                        set [yv v] to [13]\n                        start sound (pick random (1) to (5))\n                    end\n                end\n            end\n        end\n        change y by (1)\n    end\nelse\n    hide\nend\n\nchange [yv v] by (8)\n\nwhen I receive [! initalise v]\nset volume to (20) %\nforever\n    if <touching color (#59acff)?> then\n        broadcast (splash v) and wait\n    end\nend\n\nwhen [r v] key pressed\nbroadcast (pop v)\nbroadcast (reset v)\nwait until <not <key (r v) pressed?>>\nwait (1) seconds\n\nstart sound (pick random (1) to (5))\n\nstart sound (pick random (1) to (5))\n\n@end locator\n\nwhen I receive [! initalise v]\nwait (0) seconds\nset size to (490) %\nset [ghost v] effect to (100)\nshow\ngo to x: (152) y: (-127)\nforever\n    if <touching (player v)?> then\n        broadcast (level next v)\n        start sound [effect v]\n    end\nend\n\nwhen I receive [level next v]\nwait (0.1) seconds\ngo to x: (item (1) of [end v]) y: (item (2) of [end v])\nif <(Level) = [10]> then\n    hide\nend\n\nset size to (490) %\n\n@particle\n\nwhen I receive [lava v]\nset [type v] to [lava]\ngo to (player v)\nhide\nswitch costume to (effect1 v)\nset rotation style [don't rotate v]\nset [i v] to [8]\nrepeat (10)\n    create clone of (_myself_ v)\nend\n\nwhen I start as a clone\nshow\npoint in direction (pick random (-70) to (70))\nrepeat (8)\n    change [i v] by (-1)\n    move (i) steps\n    if <(type) = [water]> then\n        change y by ((1) - (i))\n    end\nend\ndelete this clone\n\nwhen I receive [splash v]\nset [type v] to [water]\ngo to (player v)\nhide\nswitch costume to (effect2 v)\nset rotation style [don't rotate v]\nset [i v] to [8]\nrepeat (10)\n    create clone of (_myself_ v)\nend\n\nwhen I receive [pop v]\nset [type v] to [pop]\ngo to (player v)\nhide\nswitch costume to (effect3 v)\nset rotation style [don't rotate v]\nset [i v] to [8]\nrepeat (5)\n    create clone of (_myself_ v)\n    create clone of (_myself_ v)\nend\n\n@thumbnail\n\nwhen I receive [! initalise v]\ngo to x: (0) y: (0)\nhide\n\nbroadcast (level next v)\n\nhide variable [level v]\nshow\ngo to [front v] layer\n\nset [level v] to [8]\n\nshow\ngo to [front v] layer\n\n@help\n\nwhen I receive [! initalise v]\nshow\ngo to [front v] layer\ngo to x: (0) y: (0)\nswitch costume to (costume1 v)\nwait (1) seconds\nwait until <(Level) = [2]>\nnext costume\nwait (5) seconds\nhide\nwait until <<(Level) = [10]> and <[50] < ([y position v] of [player v])>>\nswitch costume to (costume3 v)\nshow\n\n@border\n\n@darkness\n\nwhen flag clicked\nswitch costume to (blank v)\nset size to (400) %\nswitch costume to (dark v)\nset [ghost v] effect to (50)\nforever\n    go to (player v)\nend\n\n